using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CreatureManager; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using PieceManager; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.ObjectPool; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; using YamlDotNet.Serialization.Callbacks; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("StarwarsMobs")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Azathoth")] [assembly: AssemblyProduct("StarwarsMobs")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("29D394C1-8423-4048-B5A7-08ABE81DBA99")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace StarwarsMobs { [BepInPlugin("Azathoth.StarwarsMobs", "StarwarsMobs", "1.0.0")] public class StarwarsMobsPlugin : BaseUnityPlugin { public enum Toggle { On = 1, Off = 0 } private class ConfigurationManagerAttributes { public bool? Browsable = false; } internal const string ModName = "StarwarsMobs"; internal const string ModVersion = "1.0.0"; internal const string Author = "Azathoth"; private const string ModGUID = "Azathoth.StarwarsMobs"; private static readonly string ConfigFileName = "Azathoth.StarwarsMobs.cfg"; private static readonly string ConfigFileFullPath; internal static string ConnectionError; private readonly Harmony _harmony = new Harmony("Azathoth.StarwarsMobs"); public static readonly ManualLogSource StarwarsMobsLogger; private static readonly ConfigSync ConfigSync; private static Creature _staWookiee; private static Creature _staWookiee1; private static Creature _staWookiee2; private static Creature _staWookiee3; private static Creature _staDurosFemale; private static Creature _staDurosMale; private static Creature _staTwilekFemale; private static Creature _staTwilekMale; private static Creature _staRodian; private static Creature _staDroidBatle; private static Creature _staDroidBatle1; private static Creature _staSuperBatleDroid; private static Creature _staSuperBatleDroid1; private static Creature _staWeequayHunter; private static Creature _staEmbo; private static Creature _staDurosHunter; private static Creature _staImperialGunner; private static Creature _staCadBane; private static Creature _staHondo; private static Creature _staTrooperSnow; private static Creature _staRebelTrooper; private static Creature _staRebelTrooperV2; private static Creature _staCaraDune; private static Creature _staTusken; private static Creature _staTuskenMelee; private static Creature _staJawa; private static Creature _staGamorrean; private static Creature _staGamorreanCaptain; private static Creature _staNeumoniano; private static Creature _staYodaJedi; private static Creature _staEwook; private static Creature _staEwookChief; private static Creature _staEwookScout; private static Creature _staEwookWarrior; private static Creature _staNeimoidianViceroy; private static Creature _staWampa; private static Creature _staAdmiralAckbar; private static Creature _staConcubineFem; private static Creature _staConcubineFemB; private static Creature _staMaceWindu; private static Creature _staMasterKiAdiMundi; private static Creature _staMasterKitFisto; private static Creature _staMasterPloKon; private static Creature _staMasterQuiGonJinn; private static Creature _staDarthTyranus; private static Creature _staAsajjVentress; private static Creature _staDarthSion; private static Creature _staJedi; private static Creature _staJedi1; private static Creature _staJedi2; private static Creature _staJedi3; private static Creature _staJediPadawan; private static Creature _staJediPadawan1; private static Creature _staSithAcolityo; private static Creature _staSithAcolityoBrute; private static ConfigEntry _serverConfigLocked; private static ConfigEntry _staWookieeHealth; private static ConfigEntry _staWookiee1Health; private static ConfigEntry _staWookiee2Health; private static ConfigEntry _staWookiee3Health; private static ConfigEntry _staDurosFemaleHealth; private static ConfigEntry _staDurosMaleHealth; private static ConfigEntry _staTwilekFemaleHealth; private static ConfigEntry _staTwilekMaleHealth; private static ConfigEntry _staRodianHealth; private static ConfigEntry _staDroidBatleHealth; private static ConfigEntry _staDroidBatle1Health; private static ConfigEntry _staSuperBatleDroidHealth; private static ConfigEntry _staSuperBatleDroid1Health; private static ConfigEntry _staWeequayHunterHealth; private static ConfigEntry _staEmboHealth; private static ConfigEntry _staDurosHunterHealth; private static ConfigEntry _staImperialGunnerHealth; private static ConfigEntry _staCadBaneHealth; private static ConfigEntry _staHondoHealth; private static ConfigEntry _staTrooperSnowHealth; private static ConfigEntry _staRebelTrooperHealth; private static ConfigEntry _staRebelTrooperV2Health; private static ConfigEntry _staCaraDuneHealth; private static ConfigEntry _staTuskenHealth; private static ConfigEntry _staTuskenMeleeHealth; private static ConfigEntry _staJawaHealth; private static ConfigEntry _staGamorreanHealth; private static ConfigEntry _staGamorreanCaptainHealth; private static ConfigEntry _staNeumonianoHealth; private static ConfigEntry _staYodaJediHealth; private static ConfigEntry _staEwookHealth; private static ConfigEntry _staEwookChiefHealth; private static ConfigEntry _staEwookScoutHealth; private static ConfigEntry _staEwookWarriorHealth; private static ConfigEntry _staNeimoidianViceroyHealth; private static ConfigEntry _staWampaHealth; private static ConfigEntry _staAdmiralAckbarHealth; private static ConfigEntry _staConcubineFemHealth; private static ConfigEntry _staConcubineFemBHealth; private static ConfigEntry _staMaceWinduHealth; private static ConfigEntry _staMasterKiAdiMundiHealth; private static ConfigEntry _staMasterKitFistoHealth; private static ConfigEntry _staMasterPloKonHealth; private static ConfigEntry _staMasterQuiGonJinnHealth; private static ConfigEntry _staDarthTyranusHealth; private static ConfigEntry _staAsajjVentressHealth; private static ConfigEntry _staDarthSionHealth; private static ConfigEntry _staJediHealth; private static ConfigEntry _staJedi1Health; private static ConfigEntry _staJedi2Health; private static ConfigEntry _staJedi3Health; private static ConfigEntry _staJediPadawanHealth; private static ConfigEntry _staJediPadawan1Health; private static ConfigEntry _staSithAcolityoHealth; private static ConfigEntry _staSithAcolityoBruteHealth; private static ConfigEntry _staWookieeRunSpeed; private static ConfigEntry _staWookiee1RunSpeed; private static ConfigEntry _staWookiee2RunSpeed; private static ConfigEntry _staWookiee3RunSpeed; private static ConfigEntry _staDurosFemaleRunSpeed; private static ConfigEntry _staDurosMaleRunSpeed; private static ConfigEntry _staTwilekFemaleRunSpeed; private static ConfigEntry _staTwilekMaleRunSpeed; private static ConfigEntry _staRodianRunSpeed; private static ConfigEntry _staDroidBatleRunSpeed; private static ConfigEntry _staDroidBatle1RunSpeed; private static ConfigEntry _staSuperBatleDroidRunSpeed; private static ConfigEntry _staSuperBatleDroid1RunSpeed; private static ConfigEntry _staWeequayHunterRunSpeed; private static ConfigEntry _staEmboRunSpeed; private static ConfigEntry _staDurosHunterRunSpeed; private static ConfigEntry _staImperialGunnerRunSpeed; private static ConfigEntry _staCadBaneRunSpeed; private static ConfigEntry _staHondoRunSpeed; private static ConfigEntry _staTrooperSnowRunSpeed; private static ConfigEntry _staRebelTrooperRunSpeed; private static ConfigEntry _staRebelTrooperV2RunSpeed; private static ConfigEntry _staCaraDuneRunSpeed; private static ConfigEntry _staTuskenRunSpeed; private static ConfigEntry _staTuskenMeleeRunSpeed; private static ConfigEntry _staJawaRunSpeed; private static ConfigEntry _staGamorreanRunSpeed; private static ConfigEntry _staGamorreanCaptainRunSpeed; private static ConfigEntry _staNeumonianoRunSpeed; private static ConfigEntry _staYodaJediRunSpeed; private static ConfigEntry _staEwookRunSpeed; private static ConfigEntry _staEwookChiefRunSpeed; private static ConfigEntry _staEwookScoutRunSpeed; private static ConfigEntry _staEwookWarriorRunSpeed; private static ConfigEntry _staNeimoidianViceroyRunSpeed; private static ConfigEntry _staWampaRunSpeed; private static ConfigEntry _staAdmiralAckbarRunSpeed; private static ConfigEntry _staConcubineFemRunSpeed; private static ConfigEntry _staConcubineFemBRunSpeed; private static ConfigEntry _staMaceWinduRunSpeed; private static ConfigEntry _staMasterKiAdiMundiRunSpeed; private static ConfigEntry _staMasterKitFistoRunSpeed; private static ConfigEntry _staMasterPloKonRunSpeed; private static ConfigEntry _staMasterQuiGonJinnRunSpeed; private static ConfigEntry _staDarthTyranusRunSpeed; private static ConfigEntry _staAsajjVentressRunSpeed; private static ConfigEntry _staDarthSionRunSpeed; private static ConfigEntry _staJediRunSpeed; private static ConfigEntry _staJedi1RunSpeed; private static ConfigEntry _staJedi2RunSpeed; private static ConfigEntry _staJedi3RunSpeed; private static ConfigEntry _staJediPadawanRunSpeed; private static ConfigEntry _staJediPadawan1RunSpeed; private static ConfigEntry _staSithAcolityoRunSpeed; private static ConfigEntry _staSithAcolityoBruteRunSpeed; private static ConfigEntry _staWookieeWalkSpeed; private static ConfigEntry _staWookiee1WalkSpeed; private static ConfigEntry _staWookiee2WalkSpeed; private static ConfigEntry _staWookiee3WalkSpeed; private static ConfigEntry _staDurosFemaleWalkSpeed; private static ConfigEntry _staDurosMaleWalkSpeed; private static ConfigEntry _staTwilekFemaleWalkSpeed; private static ConfigEntry _staTwilekMaleWalkSpeed; private static ConfigEntry _staRodianWalkSpeed; private static ConfigEntry _staDroidBatleWalkSpeed; private static ConfigEntry _staDroidBatle1WalkSpeed; private static ConfigEntry _staSuperBatleDroidWalkSpeed; private static ConfigEntry _staSuperBatleDroid1WalkSpeed; private static ConfigEntry _staWeequayHunterWalkSpeed; private static ConfigEntry _staEmboWalkSpeed; private static ConfigEntry _staDurosHunterWalkSpeed; private static ConfigEntry _staImperialGunnerWalkSpeed; private static ConfigEntry _staCadBaneWalkSpeed; private static ConfigEntry _staHondoWalkSpeed; private static ConfigEntry _staTrooperSnowWalkSpeed; private static ConfigEntry _staRebelTrooperWalkSpeed; private static ConfigEntry _staRebelTrooperV2WalkSpeed; private static ConfigEntry _staCaraDuneWalkSpeed; private static ConfigEntry _staTuskenWalkSpeed; private static ConfigEntry _staTuskenMeleeWalkSpeed; private static ConfigEntry _staJawaWalkSpeed; private static ConfigEntry _staGamorreanWalkSpeed; private static ConfigEntry _staGamorreanCaptainWalkSpeed; private static ConfigEntry _staNeumonianoWalkSpeed; private static ConfigEntry _staYodaJediWalkSpeed; private static ConfigEntry _staEwookWalkSpeed; private static ConfigEntry _staEwookChiefWalkSpeed; private static ConfigEntry _staEwookScoutWalkSpeed; private static ConfigEntry _staEwookWarriorWalkSpeed; private static ConfigEntry _staNeimoidianViceroyWalkSpeed; private static ConfigEntry _staWampaWalkSpeed; private static ConfigEntry _staAdmiralAckbarWalkSpeed; private static ConfigEntry _staConcubineFemWalkSpeed; private static ConfigEntry _staConcubineFemBWalkSpeed; private static ConfigEntry _staMaceWinduWalkSpeed; private static ConfigEntry _staMasterKiAdiMundiWalkSpeed; private static ConfigEntry _staMasterKitFistoWalkSpeed; private static ConfigEntry _staMasterPloKonWalkSpeed; private static ConfigEntry _staMasterQuiGonJinnWalkSpeed; private static ConfigEntry _staDarthTyranusWalkSpeed; private static ConfigEntry _staAsajjVentressWalkSpeed; private static ConfigEntry _staDarthSionWalkSpeed; private static ConfigEntry _staJediWalkSpeed; private static ConfigEntry _staJedi1WalkSpeed; private static ConfigEntry _staJedi2WalkSpeed; private static ConfigEntry _staJedi3WalkSpeed; private static ConfigEntry _staJediPadawanWalkSpeed; private static ConfigEntry _staJediPadawan1WalkSpeed; private static ConfigEntry _staSithAcolityoWalkSpeed; private static ConfigEntry _staSithAcolityoBruteWalkSpeed; public void Awake() { try { AwakeSafe(); } catch (Exception arg) { StarwarsMobsLogger.LogError((object)$"StarwarsMobs failed during startup and disabled itself to avoid blocking Valheim loading: {arg}"); } } private void AwakeSafe() { //IL_1509: Unknown result type (might be due to invalid IL or missing references) //IL_153f: Unknown result type (might be due to invalid IL or missing references) //IL_1646: Unknown result type (might be due to invalid IL or missing references) //IL_167c: Unknown result type (might be due to invalid IL or missing references) //IL_1783: Unknown result type (might be due to invalid IL or missing references) //IL_17b9: Unknown result type (might be due to invalid IL or missing references) //IL_18c0: Unknown result type (might be due to invalid IL or missing references) //IL_18f6: Unknown result type (might be due to invalid IL or missing references) //IL_19fd: Unknown result type (might be due to invalid IL or missing references) //IL_1a33: Unknown result type (might be due to invalid IL or missing references) //IL_1b40: Unknown result type (might be due to invalid IL or missing references) //IL_1b76: Unknown result type (might be due to invalid IL or missing references) //IL_1c83: Unknown result type (might be due to invalid IL or missing references) //IL_1cb9: Unknown result type (might be due to invalid IL or missing references) //IL_1dc6: Unknown result type (might be due to invalid IL or missing references) //IL_1dfc: Unknown result type (might be due to invalid IL or missing references) //IL_1f09: Unknown result type (might be due to invalid IL or missing references) //IL_1f3f: Unknown result type (might be due to invalid IL or missing references) //IL_204c: Unknown result type (might be due to invalid IL or missing references) //IL_2082: Unknown result type (might be due to invalid IL or missing references) //IL_218f: Unknown result type (might be due to invalid IL or missing references) //IL_21c5: Unknown result type (might be due to invalid IL or missing references) //IL_22d2: Unknown result type (might be due to invalid IL or missing references) //IL_2309: Unknown result type (might be due to invalid IL or missing references) //IL_23d7: Unknown result type (might be due to invalid IL or missing references) //IL_2411: Unknown result type (might be due to invalid IL or missing references) //IL_24de: Unknown result type (might be due to invalid IL or missing references) //IL_2515: Unknown result type (might be due to invalid IL or missing references) //IL_25e3: Unknown result type (might be due to invalid IL or missing references) //IL_261d: Unknown result type (might be due to invalid IL or missing references) //IL_26ea: Unknown result type (might be due to invalid IL or missing references) //IL_2720: Unknown result type (might be due to invalid IL or missing references) //IL_27ee: Unknown result type (might be due to invalid IL or missing references) //IL_2828: Unknown result type (might be due to invalid IL or missing references) //IL_28f6: Unknown result type (might be due to invalid IL or missing references) //IL_2930: Unknown result type (might be due to invalid IL or missing references) //IL_29fd: Unknown result type (might be due to invalid IL or missing references) //IL_2a34: Unknown result type (might be due to invalid IL or missing references) //IL_2b01: Unknown result type (might be due to invalid IL or missing references) //IL_2b37: Unknown result type (might be due to invalid IL or missing references) //IL_2c04: Unknown result type (might be due to invalid IL or missing references) //IL_2c3b: Unknown result type (might be due to invalid IL or missing references) //IL_2d09: Unknown result type (might be due to invalid IL or missing references) //IL_2d43: Unknown result type (might be due to invalid IL or missing references) //IL_2e11: Unknown result type (might be due to invalid IL or missing references) //IL_2e4b: Unknown result type (might be due to invalid IL or missing references) //IL_2f18: Unknown result type (might be due to invalid IL or missing references) //IL_2f4f: Unknown result type (might be due to invalid IL or missing references) //IL_305c: Unknown result type (might be due to invalid IL or missing references) //IL_3093: Unknown result type (might be due to invalid IL or missing references) //IL_31a0: Unknown result type (might be due to invalid IL or missing references) //IL_31d7: Unknown result type (might be due to invalid IL or missing references) //IL_32e4: Unknown result type (might be due to invalid IL or missing references) //IL_331b: Unknown result type (might be due to invalid IL or missing references) //IL_3428: Unknown result type (might be due to invalid IL or missing references) //IL_345f: Unknown result type (might be due to invalid IL or missing references) //IL_356c: Unknown result type (might be due to invalid IL or missing references) //IL_35a3: Unknown result type (might be due to invalid IL or missing references) //IL_36b1: Unknown result type (might be due to invalid IL or missing references) //IL_36eb: Unknown result type (might be due to invalid IL or missing references) //IL_37f8: Unknown result type (might be due to invalid IL or missing references) //IL_382e: Unknown result type (might be due to invalid IL or missing references) //IL_393b: Unknown result type (might be due to invalid IL or missing references) //IL_3971: Unknown result type (might be due to invalid IL or missing references) //IL_3a7e: Unknown result type (might be due to invalid IL or missing references) //IL_3ab4: Unknown result type (might be due to invalid IL or missing references) //IL_3bc1: Unknown result type (might be due to invalid IL or missing references) //IL_3bf7: Unknown result type (might be due to invalid IL or missing references) //IL_3d04: Unknown result type (might be due to invalid IL or missing references) //IL_3d3e: Unknown result type (might be due to invalid IL or missing references) //IL_3e4b: Unknown result type (might be due to invalid IL or missing references) //IL_3e81: Unknown result type (might be due to invalid IL or missing references) //IL_3f8f: Unknown result type (might be due to invalid IL or missing references) //IL_3fc9: Unknown result type (might be due to invalid IL or missing references) //IL_40d6: Unknown result type (might be due to invalid IL or missing references) //IL_410c: Unknown result type (might be due to invalid IL or missing references) //IL_41d9: Unknown result type (might be due to invalid IL or missing references) //IL_420f: Unknown result type (might be due to invalid IL or missing references) //IL_42dd: Unknown result type (might be due to invalid IL or missing references) //IL_4317: Unknown result type (might be due to invalid IL or missing references) //IL_43e5: Unknown result type (might be due to invalid IL or missing references) //IL_441f: Unknown result type (might be due to invalid IL or missing references) //IL_44ed: Unknown result type (might be due to invalid IL or missing references) //IL_4527: Unknown result type (might be due to invalid IL or missing references) //IL_45f5: Unknown result type (might be due to invalid IL or missing references) //IL_462f: Unknown result type (might be due to invalid IL or missing references) //IL_46fd: Unknown result type (might be due to invalid IL or missing references) //IL_4737: Unknown result type (might be due to invalid IL or missing references) //IL_4804: Unknown result type (might be due to invalid IL or missing references) //IL_483e: Unknown result type (might be due to invalid IL or missing references) //IL_48eb: Unknown result type (might be due to invalid IL or missing references) //IL_492c: Unknown result type (might be due to invalid IL or missing references) //IL_4966: Unknown result type (might be due to invalid IL or missing references) //IL_4a13: Unknown result type (might be due to invalid IL or missing references) //IL_4a54: Unknown result type (might be due to invalid IL or missing references) //IL_4a8e: Unknown result type (might be due to invalid IL or missing references) //IL_4b5c: Unknown result type (might be due to invalid IL or missing references) //IL_4b96: Unknown result type (might be due to invalid IL or missing references) //IL_4c64: Unknown result type (might be due to invalid IL or missing references) //IL_4c9e: Unknown result type (might be due to invalid IL or missing references) //IL_4d6c: Unknown result type (might be due to invalid IL or missing references) //IL_4da6: Unknown result type (might be due to invalid IL or missing references) //IL_4e74: Unknown result type (might be due to invalid IL or missing references) //IL_4eae: Unknown result type (might be due to invalid IL or missing references) //IL_4f7c: Unknown result type (might be due to invalid IL or missing references) //IL_4fb6: Unknown result type (might be due to invalid IL or missing references) //IL_5084: Unknown result type (might be due to invalid IL or missing references) //IL_50be: Unknown result type (might be due to invalid IL or missing references) //IL_518b: Unknown result type (might be due to invalid IL or missing references) //IL_51c5: Unknown result type (might be due to invalid IL or missing references) //IL_5272: Unknown result type (might be due to invalid IL or missing references) //IL_52b3: Unknown result type (might be due to invalid IL or missing references) //IL_52ed: Unknown result type (might be due to invalid IL or missing references) //IL_539a: Unknown result type (might be due to invalid IL or missing references) Localizer.Load(); _serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only."); ConfigSync.AddLockingConfigEntry(_serverConfigLocked); _staWookieeHealth = config("2 - STA_Wookiee", "Health", 800f, "Base health for STA_Wookiee"); _staWookieeRunSpeed = config("2 - STA_Wookiee", "Run Speed", 6.7f, "Base run speed for STA_Wookiee"); _staWookieeWalkSpeed = config("2 - STA_Wookiee", "Walk Speed", 2.7f, "Base walk speed for STA_Wookiee"); _staWookiee1Health = config("3 - STA_Wookiee1", "Health", 900f, "Base health for STA_Wookiee1"); _staWookiee1RunSpeed = config("3 - STA_Wookiee1", "Run Speed", 6.7f, "Base run speed for STA_Wookiee1"); _staWookiee1WalkSpeed = config("3 - STA_Wookiee1", "Walk Speed", 2.7f, "Base walk speed for STA_Wookiee1"); _staWookiee2Health = config("4 - STA_Wookiee2", "Health", 1050f, "Base health for STA_Wookiee2"); _staWookiee2RunSpeed = config("4 - STA_Wookiee2", "Run Speed", 6.8f, "Base run speed for STA_Wookiee2"); _staWookiee2WalkSpeed = config("4 - STA_Wookiee2", "Walk Speed", 2.8f, "Base walk speed for STA_Wookiee2"); _staWookiee3Health = config("5 - STA_Wookiee3", "Health", 1250f, "Base health for STA_Wookiee3"); _staWookiee3RunSpeed = config("5 - STA_Wookiee3", "Run Speed", 6.8f, "Base run speed for STA_Wookiee3"); _staWookiee3WalkSpeed = config("5 - STA_Wookiee3", "Walk Speed", 2.8f, "Base walk speed for STA_Wookiee3"); _staDurosFemaleHealth = config("6 - STA_DUROSFEMALE", "Health", 520f, "Base health for STA_DUROSFEMALE"); _staDurosFemaleRunSpeed = config("6 - STA_DUROSFEMALE", "Run Speed", 6.9f, "Base run speed for STA_DUROSFEMALE"); _staDurosFemaleWalkSpeed = config("6 - STA_DUROSFEMALE", "Walk Speed", 2.8f, "Base walk speed for STA_DUROSFEMALE"); _staDurosMaleHealth = config("7 - STA_DUROSMALE", "Health", 580f, "Base health for STA_DUROSMALE"); _staDurosMaleRunSpeed = config("7 - STA_DUROSMALE", "Run Speed", 6.9f, "Base run speed for STA_DUROSMALE"); _staDurosMaleWalkSpeed = config("7 - STA_DUROSMALE", "Walk Speed", 2.8f, "Base walk speed for STA_DUROSMALE"); _staTwilekFemaleHealth = config("8 - STA_TWILEKFEMALE", "Health", 520f, "Base health for STA_TWILEKFEMALE"); _staTwilekFemaleRunSpeed = config("8 - STA_TWILEKFEMALE", "Run Speed", 6.9f, "Base run speed for STA_TWILEKFEMALE"); _staTwilekFemaleWalkSpeed = config("8 - STA_TWILEKFEMALE", "Walk Speed", 2.8f, "Base walk speed for STA_TWILEKFEMALE"); _staTwilekMaleHealth = config("9 - STA_TWILEKMALE", "Health", 580f, "Base health for STA_TWILEKMALE"); _staTwilekMaleRunSpeed = config("9 - STA_TWILEKMALE", "Run Speed", 6.9f, "Base run speed for STA_TWILEKMALE"); _staTwilekMaleWalkSpeed = config("9 - STA_TWILEKMALE", "Walk Speed", 2.8f, "Base walk speed for STA_TWILEKMALE"); _staRodianHealth = config("10 - STA_RODIAN", "Health", 750f, "Base health for STA_RODIAN"); _staRodianRunSpeed = config("10 - STA_RODIAN", "Run Speed", 7.2f, "Base run speed for STA_RODIAN"); _staRodianWalkSpeed = config("10 - STA_RODIAN", "Walk Speed", 2.9f, "Base walk speed for STA_RODIAN"); _staDroidBatleHealth = config("53 - STA_DROIDBATLE", "Health", 720f, "Base health for STA_DROIDBATLE"); _staDroidBatleRunSpeed = config("53 - STA_DROIDBATLE", "Run Speed", 6.6f, "Base run speed for STA_DROIDBATLE"); _staDroidBatleWalkSpeed = config("53 - STA_DROIDBATLE", "Walk Speed", 2.6f, "Base walk speed for STA_DROIDBATLE"); _staDroidBatle1Health = config("54 - STA_DROIDBATLE1", "Health", 920f, "Base health for STA_DROIDBATLE1"); _staDroidBatle1RunSpeed = config("54 - STA_DROIDBATLE1", "Run Speed", 6.8f, "Base run speed for STA_DROIDBATLE1"); _staDroidBatle1WalkSpeed = config("54 - STA_DROIDBATLE1", "Walk Speed", 2.7f, "Base walk speed for STA_DROIDBATLE1"); _staSuperBatleDroidHealth = config("55 - STA_SUPERBATLEDROID", "Health", 1450f, "Base health for STA_SUPERBATLEDROID"); _staSuperBatleDroidRunSpeed = config("55 - STA_SUPERBATLEDROID", "Run Speed", 6.4f, "Base run speed for STA_SUPERBATLEDROID"); _staSuperBatleDroidWalkSpeed = config("55 - STA_SUPERBATLEDROID", "Walk Speed", 2.55f, "Base walk speed for STA_SUPERBATLEDROID"); _staSuperBatleDroid1Health = config("56 - STA_SUPERBATLEDROID1", "Health", 1700f, "Base health for STA_SUPERBATLEDROID1"); _staSuperBatleDroid1RunSpeed = config("56 - STA_SUPERBATLEDROID1", "Run Speed", 6.55f, "Base run speed for STA_SUPERBATLEDROID1"); _staSuperBatleDroid1WalkSpeed = config("56 - STA_SUPERBATLEDROID1", "Walk Speed", 2.65f, "Base walk speed for STA_SUPERBATLEDROID1"); _staTuskenHealth = config("11 - STA_TUSKEN", "Health", 850f, "Base health for STA_TUSKEN"); _staTuskenRunSpeed = config("11 - STA_TUSKEN", "Run Speed", 7f, "Base run speed for STA_TUSKEN"); _staTuskenWalkSpeed = config("11 - STA_TUSKEN", "Walk Speed", 2.8f, "Base walk speed for STA_TUSKEN"); _staTuskenMeleeHealth = config("12 - STA_TUSKENMELEE", "Health", 1050f, "Base health for STA_TUSKENMELEE"); _staTuskenMeleeRunSpeed = config("12 - STA_TUSKENMELEE", "Run Speed", 6.9f, "Base run speed for STA_TUSKENMELEE"); _staTuskenMeleeWalkSpeed = config("12 - STA_TUSKENMELEE", "Walk Speed", 2.8f, "Base walk speed for STA_TUSKENMELEE"); _staJawaHealth = config("13 - STA_JAWA", "Health", 450f, "Base health for STA_JAWA"); _staJawaRunSpeed = config("13 - STA_JAWA", "Run Speed", 7.2f, "Base run speed for STA_JAWA"); _staJawaWalkSpeed = config("13 - STA_JAWA", "Walk Speed", 2.8f, "Base walk speed for STA_JAWA"); _staGamorreanHealth = config("14 - STA_GAMORREAN", "Health", 1250f, "Base health for STA_GAMORREAN"); _staGamorreanRunSpeed = config("14 - STA_GAMORREAN", "Run Speed", 5.9f, "Base run speed for STA_GAMORREAN"); _staGamorreanWalkSpeed = config("14 - STA_GAMORREAN", "Walk Speed", 2.35f, "Base walk speed for STA_GAMORREAN"); _staGamorreanCaptainHealth = config("15 - STA_GAMORREANCAPITAN", "Health", 1900f, "Base health for STA_GAMORREANCAPITAN"); _staGamorreanCaptainRunSpeed = config("15 - STA_GAMORREANCAPITAN", "Run Speed", 6f, "Base run speed for STA_GAMORREANCAPITAN"); _staGamorreanCaptainWalkSpeed = config("15 - STA_GAMORREANCAPITAN", "Walk Speed", 2.45f, "Base walk speed for STA_GAMORREANCAPITAN"); _staNeumonianoHealth = config("16 - STA_NEUMONIANO", "Health", 900f, "Base health for STA_NEUMONIANO"); _staNeumonianoRunSpeed = config("16 - STA_NEUMONIANO", "Run Speed", 6.5f, "Base run speed for STA_NEUMONIANO"); _staNeumonianoWalkSpeed = config("16 - STA_NEUMONIANO", "Walk Speed", 2.6f, "Base walk speed for STA_NEUMONIANO"); _staYodaJediHealth = config("17 - STA_YODAJEDI", "Health", 3200f, "Base health for STA_YODAJEDI"); _staYodaJediRunSpeed = config("17 - STA_YODAJEDI", "Run Speed", 8.1f, "Base run speed for STA_YODAJEDI"); _staYodaJediWalkSpeed = config("17 - STA_YODAJEDI", "Walk Speed", 3.2f, "Base walk speed for STA_YODAJEDI"); _staEwookHealth = config("18 - STA_EWOOK", "Health", 420f, "Base health for STA_EWOOK"); _staEwookRunSpeed = config("18 - STA_EWOOK", "Run Speed", 6.9f, "Base run speed for STA_EWOOK"); _staEwookWalkSpeed = config("18 - STA_EWOOK", "Walk Speed", 2.7f, "Base walk speed for STA_EWOOK"); _staEwookChiefHealth = config("19 - STA_EWOOKCHIEF", "Health", 1000f, "Base health for STA_EWOOKCHIEF"); _staEwookChiefRunSpeed = config("19 - STA_EWOOKCHIEF", "Run Speed", 6.6f, "Base run speed for STA_EWOOKCHIEF"); _staEwookChiefWalkSpeed = config("19 - STA_EWOOKCHIEF", "Walk Speed", 2.6f, "Base walk speed for STA_EWOOKCHIEF"); _staEwookScoutHealth = config("20 - STA_EWOOKSCOUT", "Health", 380f, "Base health for STA_EWOOKSCOUT"); _staEwookScoutRunSpeed = config("20 - STA_EWOOKSCOUT", "Run Speed", 7.8f, "Base run speed for STA_EWOOKSCOUT"); _staEwookScoutWalkSpeed = config("20 - STA_EWOOKSCOUT", "Walk Speed", 3.1f, "Base walk speed for STA_EWOOKSCOUT"); _staEwookWarriorHealth = config("21 - STA_EWOOKWARRIOR", "Health", 720f, "Base health for STA_EWOOKWARRIOR"); _staEwookWarriorRunSpeed = config("21 - STA_EWOOKWARRIOR", "Run Speed", 7.1f, "Base run speed for STA_EWOOKWARRIOR"); _staEwookWarriorWalkSpeed = config("21 - STA_EWOOKWARRIOR", "Walk Speed", 2.8f, "Base walk speed for STA_EWOOKWARRIOR"); _staNeimoidianViceroyHealth = config("22 - STA_NEIMOIDIANVICEROY", "Health", 1450f, "Base health for STA_NEIMOIDIANVICEROY"); _staNeimoidianViceroyRunSpeed = config("22 - STA_NEIMOIDIANVICEROY", "Run Speed", 6f, "Base run speed for STA_NEIMOIDIANVICEROY"); _staNeimoidianViceroyWalkSpeed = config("22 - STA_NEIMOIDIANVICEROY", "Walk Speed", 2.4f, "Base walk speed for STA_NEIMOIDIANVICEROY"); _staWampaHealth = config("23 - STA_WAMPA", "Health", 2800f, "Base health for STA_WAMPA"); _staWampaRunSpeed = config("23 - STA_WAMPA", "Run Speed", 6.6f, "Base run speed for STA_WAMPA"); _staWampaWalkSpeed = config("23 - STA_WAMPA", "Walk Speed", 2.65f, "Base walk speed for STA_WAMPA"); _staAdmiralAckbarHealth = config("24 - STA_ADMIRALACKBAR", "Health", 1500f, "Base health for STA_ADMIRALACKBAR"); _staAdmiralAckbarRunSpeed = config("24 - STA_ADMIRALACKBAR", "Run Speed", 6.7f, "Base run speed for STA_ADMIRALACKBAR"); _staAdmiralAckbarWalkSpeed = config("24 - STA_ADMIRALACKBAR", "Walk Speed", 2.7f, "Base walk speed for STA_ADMIRALACKBAR"); _staConcubineFemHealth = config("25 - STA_CONCUBINEFEM", "Health", 650f, "Base health for STA_CONCUBINEFEM"); _staConcubineFemRunSpeed = config("25 - STA_CONCUBINEFEM", "Run Speed", 6.9f, "Base run speed for STA_CONCUBINEFEM"); _staConcubineFemWalkSpeed = config("25 - STA_CONCUBINEFEM", "Walk Speed", 2.75f, "Base walk speed for STA_CONCUBINEFEM"); _staConcubineFemBHealth = config("26 - STA_CONCUBINEFEMB", "Health", 700f, "Base health for STA_CONCUBINEFEMB"); _staConcubineFemBRunSpeed = config("26 - STA_CONCUBINEFEMB", "Run Speed", 6.9f, "Base run speed for STA_CONCUBINEFEMB"); _staConcubineFemBWalkSpeed = config("26 - STA_CONCUBINEFEMB", "Walk Speed", 2.75f, "Base walk speed for STA_CONCUBINEFEMB"); _staMaceWinduHealth = config("27 - STA_MACEWINDU", "Health", 3400f, "Base health for STA_MACEWINDU"); _staMaceWinduRunSpeed = config("27 - STA_MACEWINDU", "Run Speed", 7.6f, "Base run speed for STA_MACEWINDU"); _staMaceWinduWalkSpeed = config("27 - STA_MACEWINDU", "Walk Speed", 3.05f, "Base walk speed for STA_MACEWINDU"); _staMasterKiAdiMundiHealth = config("28 - STA_MASTERKIADIMUNDI", "Health", 3100f, "Base health for STA_MASTERKIADIMUNDI"); _staMasterKiAdiMundiRunSpeed = config("28 - STA_MASTERKIADIMUNDI", "Run Speed", 7.5f, "Base run speed for STA_MASTERKIADIMUNDI"); _staMasterKiAdiMundiWalkSpeed = config("28 - STA_MASTERKIADIMUNDI", "Walk Speed", 3f, "Base walk speed for STA_MASTERKIADIMUNDI"); _staMasterKitFistoHealth = config("29 - STA_MASTERKITFISTO", "Health", 3200f, "Base health for STA_MASTERKITFISTO"); _staMasterKitFistoRunSpeed = config("29 - STA_MASTERKITFISTO", "Run Speed", 7.7f, "Base run speed for STA_MASTERKITFISTO"); _staMasterKitFistoWalkSpeed = config("29 - STA_MASTERKITFISTO", "Walk Speed", 3.05f, "Base walk speed for STA_MASTERKITFISTO"); _staMasterPloKonHealth = config("30 - STA_MASTERPLOKON", "Health", 3200f, "Base health for STA_MASTERPLOKON"); _staMasterPloKonRunSpeed = config("30 - STA_MASTERPLOKON", "Run Speed", 7.6f, "Base run speed for STA_MASTERPLOKON"); _staMasterPloKonWalkSpeed = config("30 - STA_MASTERPLOKON", "Walk Speed", 3.05f, "Base walk speed for STA_MASTERPLOKON"); _staMasterQuiGonJinnHealth = config("31 - STA_MASTERQUIGONJINN", "Health", 3100f, "Base health for STA_MASTERQUIGONJINN"); _staMasterQuiGonJinnRunSpeed = config("31 - STA_MASTERQUIGONJINN", "Run Speed", 7.5f, "Base run speed for STA_MASTERQUIGONJINN"); _staMasterQuiGonJinnWalkSpeed = config("31 - STA_MASTERQUIGONJINN", "Walk Speed", 3f, "Base walk speed for STA_MASTERQUIGONJINN"); _staDarthTyranusHealth = config("32 - STA_DARTHTYRANUS", "Health", 3600f, "Base health for STA_DARTHTYRANUS"); _staDarthTyranusRunSpeed = config("32 - STA_DARTHTYRANUS", "Run Speed", 7.7f, "Base run speed for STA_DARTHTYRANUS"); _staDarthTyranusWalkSpeed = config("32 - STA_DARTHTYRANUS", "Walk Speed", 3.05f, "Base walk speed for STA_DARTHTYRANUS"); _staAsajjVentressHealth = config("33 - STA_AsajjVentress", "Health", 2400f, "Base health for STA_AsajjVentress"); _staAsajjVentressRunSpeed = config("33 - STA_AsajjVentress", "Run Speed", 8.2f, "Base run speed for STA_AsajjVentress"); _staAsajjVentressWalkSpeed = config("33 - STA_AsajjVentress", "Walk Speed", 3.2f, "Base walk speed for STA_AsajjVentress"); _staDarthSionHealth = config("34 - STA_DARTHSION", "Health", 3900f, "Base health for STA_DARTHSION"); _staDarthSionRunSpeed = config("34 - STA_DARTHSION", "Run Speed", 6.9f, "Base run speed for STA_DARTHSION"); _staDarthSionWalkSpeed = config("34 - STA_DARTHSION", "Walk Speed", 2.75f, "Base walk speed for STA_DARTHSION"); _staJediHealth = config("35 - STA_JEDI", "Health", 1500f, "Base health for STA_JEDI"); _staJediRunSpeed = config("35 - STA_JEDI", "Run Speed", 7.3f, "Base run speed for STA_JEDI"); _staJediWalkSpeed = config("35 - STA_JEDI", "Walk Speed", 2.9f, "Base walk speed for STA_JEDI"); _staJedi1Health = config("36 - STA_JEDI1", "Health", 1700f, "Base health for STA_JEDI1"); _staJedi1RunSpeed = config("36 - STA_JEDI1", "Run Speed", 7.4f, "Base run speed for STA_JEDI1"); _staJedi1WalkSpeed = config("36 - STA_JEDI1", "Walk Speed", 2.95f, "Base walk speed for STA_JEDI1"); _staJedi2Health = config("37 - STA_JEDI2", "Health", 1500f, "Base health for STA_JEDI2"); _staJedi2RunSpeed = config("37 - STA_JEDI2", "Run Speed", 7.3f, "Base run speed for STA_JEDI2"); _staJedi2WalkSpeed = config("37 - STA_JEDI2", "Walk Speed", 2.9f, "Base walk speed for STA_JEDI2"); _staJedi3Health = config("38 - STA_JEDI3", "Health", 1700f, "Base health for STA_JEDI3"); _staJedi3RunSpeed = config("38 - STA_JEDI3", "Run Speed", 7.4f, "Base run speed for STA_JEDI3"); _staJedi3WalkSpeed = config("38 - STA_JEDI3", "Walk Speed", 2.95f, "Base walk speed for STA_JEDI3"); _staJediPadawanHealth = config("39 - STA_JEDIPADAWAN", "Health", 900f, "Base health for STA_JEDIPADAWAN"); _staJediPadawanRunSpeed = config("39 - STA_JEDIPADAWAN", "Run Speed", 7f, "Base run speed for STA_JEDIPADAWAN"); _staJediPadawanWalkSpeed = config("39 - STA_JEDIPADAWAN", "Walk Speed", 2.7f, "Base walk speed for STA_JEDIPADAWAN"); _staJediPadawan1Health = config("40 - STA_JEDIPADAWAN1", "Health", 950f, "Base health for STA_JEDIPADAWAN1"); _staJediPadawan1RunSpeed = config("40 - STA_JEDIPADAWAN1", "Run Speed", 7f, "Base run speed for STA_JEDIPADAWAN1"); _staJediPadawan1WalkSpeed = config("40 - STA_JEDIPADAWAN1", "Walk Speed", 2.7f, "Base walk speed for STA_JEDIPADAWAN1"); _staSithAcolityoHealth = config("41 - STA_SITHACOLITYO", "Health", 1450f, "Base health for STA_SITHACOLITYO"); _staSithAcolityoRunSpeed = config("41 - STA_SITHACOLITYO", "Run Speed", 7.4f, "Base run speed for STA_SITHACOLITYO"); _staSithAcolityoWalkSpeed = config("41 - STA_SITHACOLITYO", "Walk Speed", 2.9f, "Base walk speed for STA_SITHACOLITYO"); _staSithAcolityoBruteHealth = config("42 - STA_SITHACOLITYOBRUTE", "Health", 2200f, "Base health for STA_SITHACOLITYOBRUTE"); _staSithAcolityoBruteRunSpeed = config("42 - STA_SITHACOLITYOBRUTE", "Run Speed", 6.5f, "Base run speed for STA_SITHACOLITYOBRUTE"); _staSithAcolityoBruteWalkSpeed = config("42 - STA_SITHACOLITYOBRUTE", "Walk Speed", 2.55f, "Base walk speed for STA_SITHACOLITYOBRUTE"); _staWeequayHunterHealth = config("43 - STA_WEEQUAYHUNTER", "Health", 900f, "Base health for STA_WEEQUAYHUNTER"); _staWeequayHunterRunSpeed = config("43 - STA_WEEQUAYHUNTER", "Run Speed", 7.25f, "Base run speed for STA_WEEQUAYHUNTER"); _staWeequayHunterWalkSpeed = config("43 - STA_WEEQUAYHUNTER", "Walk Speed", 2.9f, "Base walk speed for STA_WEEQUAYHUNTER"); _staEmboHealth = config("44 - STA_EMBO", "Health", 2100f, "Base health for STA_EMBO"); _staEmboRunSpeed = config("44 - STA_EMBO", "Run Speed", 7.8f, "Base run speed for STA_EMBO"); _staEmboWalkSpeed = config("44 - STA_EMBO", "Walk Speed", 3.05f, "Base walk speed for STA_EMBO"); _staDurosHunterHealth = config("45 - STA_DUROSHUNTER", "Health", 820f, "Base health for STA_DUROSHUNTER"); _staDurosHunterRunSpeed = config("45 - STA_DUROSHUNTER", "Run Speed", 7.15f, "Base run speed for STA_DUROSHUNTER"); _staDurosHunterWalkSpeed = config("45 - STA_DUROSHUNTER", "Walk Speed", 2.85f, "Base walk speed for STA_DUROSHUNTER"); _staImperialGunnerHealth = config("46 - STA_IMPERIALGUNNER", "Health", 1250f, "Base health for STA_IMPERIALGUNNER"); _staImperialGunnerRunSpeed = config("46 - STA_IMPERIALGUNNER", "Run Speed", 6.8f, "Base run speed for STA_IMPERIALGUNNER"); _staImperialGunnerWalkSpeed = config("46 - STA_IMPERIALGUNNER", "Walk Speed", 2.7f, "Base walk speed for STA_IMPERIALGUNNER"); _staCadBaneHealth = config("47 - STA_CADBANE", "Health", 2400f, "Base health for STA_CADBANE"); _staCadBaneRunSpeed = config("47 - STA_CADBANE", "Run Speed", 8f, "Base run speed for STA_CADBANE"); _staCadBaneWalkSpeed = config("47 - STA_CADBANE", "Walk Speed", 3.1f, "Base walk speed for STA_CADBANE"); _staHondoHealth = config("48 - STA_HONDO", "Health", 1600f, "Base health for STA_HONDO"); _staHondoRunSpeed = config("48 - STA_HONDO", "Run Speed", 7.35f, "Base run speed for STA_HONDO"); _staHondoWalkSpeed = config("48 - STA_HONDO", "Walk Speed", 2.95f, "Base walk speed for STA_HONDO"); _staTrooperSnowHealth = config("49 - STA_TROOPERSNOW", "Health", 1350f, "Base health for STA_TROOPERSNOW"); _staTrooperSnowRunSpeed = config("49 - STA_TROOPERSNOW", "Run Speed", 6.6f, "Base run speed for STA_TROOPERSNOW"); _staTrooperSnowWalkSpeed = config("49 - STA_TROOPERSNOW", "Walk Speed", 2.65f, "Base walk speed for STA_TROOPERSNOW"); _staRebelTrooperHealth = config("50 - STA_REBELTROOPER", "Health", 1150f, "Base health for STA_REBELTROOPER"); _staRebelTrooperRunSpeed = config("50 - STA_REBELTROOPER", "Run Speed", 6.9f, "Base run speed for STA_REBELTROOPER"); _staRebelTrooperWalkSpeed = config("50 - STA_REBELTROOPER", "Walk Speed", 2.75f, "Base walk speed for STA_REBELTROOPER"); _staRebelTrooperV2Health = config("51 - STA_REBELTROOPERV2", "Health", 1350f, "Base health for STA_REBELTROOPERV2"); _staRebelTrooperV2RunSpeed = config("51 - STA_REBELTROOPERV2", "Run Speed", 7.05f, "Base run speed for STA_REBELTROOPERV2"); _staRebelTrooperV2WalkSpeed = config("51 - STA_REBELTROOPERV2", "Walk Speed", 2.85f, "Base walk speed for STA_REBELTROOPERV2"); _staCaraDuneHealth = config("52 - STA_CARADUNE", "Health", 1850f, "Base health for STA_CARADUNE"); _staCaraDuneRunSpeed = config("52 - STA_CARADUNE", "Run Speed", 7.35f, "Base run speed for STA_CARADUNE"); _staCaraDuneWalkSpeed = config("52 - STA_CARADUNE", "Walk Speed", 2.95f, "Base walk speed for STA_CARADUNE"); Creature creature = new Creature("starwarsmobs", "STA_Wookiee") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature.Localize().English("Wookiee").Spanish("Wookiee"); creature.Drops["STA_TrophyWookie"].Amount = new CreatureManager.Range(1f, 1f); creature.Drops["STA_TrophyWookie"].DropChance = 10f; _staWookiee = creature; MaterialReplacer.RegisterWookieeFurFix(creature.Prefab); Creature creature2 = new Creature("starwarsmobs", "STA_Wookiee1") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature2.Localize().English("Wookiee Warrior").Spanish("Guerrero Wookiee"); creature2.Drops["STA_TrophyWookie"].Amount = new CreatureManager.Range(1f, 1f); creature2.Drops["STA_TrophyWookie"].DropChance = 10f; _staWookiee1 = creature2; MaterialReplacer.RegisterWookieeFurFix(creature2.Prefab); Creature creature3 = new Creature("starwarsmobs", "STA_Wookiee2") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature3.Localize().English("Wookiee Guardian").Spanish("Guardián Wookiee"); creature3.Drops["STA_TrophyWookie"].Amount = new CreatureManager.Range(1f, 1f); creature3.Drops["STA_TrophyWookie"].DropChance = 10f; _staWookiee2 = creature3; MaterialReplacer.RegisterWookieeFurFix(creature3.Prefab); Creature creature4 = new Creature("starwarsmobs", "STA_Wookiee3") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature4.Localize().English("Wookiee Champion").Spanish("Campeón Wookiee"); creature4.Drops["STA_TrophyWookie"].Amount = new CreatureManager.Range(1f, 1f); creature4.Drops["STA_TrophyWookie"].DropChance = 10f; _staWookiee3 = creature4; MaterialReplacer.RegisterWookieeFurFix(creature4.Prefab); Creature creature5 = new Creature("starwarsmobs", "STA_DUROSFEMALE") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature5.Localize().English("Female Duros").Spanish("Duros hembra"); creature5.Drops["STA_TrophyDuros"].Amount = new CreatureManager.Range(1f, 1f); creature5.Drops["STA_TrophyDuros"].DropChance = 10f; _staDurosFemale = creature5; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature5.Prefab); Creature creature6 = new Creature("starwarsmobs", "STA_DUROSMALE") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature6.Localize().English("Male Duros").Spanish("Duros macho"); creature6.Drops["STA_TrophyDuros"].Amount = new CreatureManager.Range(1f, 1f); creature6.Drops["STA_TrophyDuros"].DropChance = 10f; _staDurosMale = creature6; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature6.Prefab); Creature creature7 = new Creature("starwarsmobs", "STA_TWILEKFEMALE") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature7.Localize().English("Female Twi'lek").Spanish("Twi'lek femenina"); creature7.Drops["STA_TrophyTwilekFemale"].Amount = new CreatureManager.Range(1f, 1f); creature7.Drops["STA_TrophyTwilekFemale"].DropChance = 10f; _staTwilekFemale = creature7; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature7.Prefab); Creature creature8 = new Creature("starwarsmobs", "STA_TWILEKMALE") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature8.Localize().English("Male Twi'lek").Spanish("Twi'lek masculino"); creature8.Drops["STA_TrophyTwilekMale"].Amount = new CreatureManager.Range(1f, 1f); creature8.Drops["STA_TrophyTwilekMale"].DropChance = 10f; _staTwilekMale = creature8; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature8.Prefab); Creature creature9 = new Creature("starwarsmobs", "STA_RODIAN") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature9.Localize().English("Rodian").Spanish("Rodiano"); creature9.Drops["STA_TrophyRODIAN"].Amount = new CreatureManager.Range(1f, 1f); creature9.Drops["STA_TrophyRODIAN"].DropChance = 10f; _staRodian = creature9; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature9.Prefab); Creature creature10 = new Creature("starwarsmobs", "STA_DROIDBATLE") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 3f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature10.Localize().English("Battle Droid").Spanish("Droide de batalla"); creature10.Drops["STA_TrophyDROIDBATLE"].Amount = new CreatureManager.Range(1f, 1f); creature10.Drops["STA_TrophyDROIDBATLE"].DropChance = 10f; _staDroidBatle = creature10; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature10.Prefab); Creature creature11 = new Creature("starwarsmobs", "STA_DROIDBATLE1") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 8f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature11.Localize().English("Yellow Battle Droid").Spanish("Droide de batalla amarillo"); creature11.Drops["STA_TrophyDROIDBATLE1"].Amount = new CreatureManager.Range(1f, 1f); creature11.Drops["STA_TrophyDROIDBATLE1"].DropChance = 10f; _staDroidBatle1 = creature11; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature11.Prefab); Creature creature12 = new Creature("starwarsmobs", "STA_SUPERBATLEDROID") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1500, SpawnChance = 7f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature12.Localize().English("Super Battle Droid").Spanish("Super droide de batalla"); _staSuperBatleDroid = creature12; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature12.Prefab); Creature creature13 = new Creature("starwarsmobs", "STA_SUPERBATLEDROID1") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature13.Localize().English("White Super Battle Droid").Spanish("Super droide de batalla blanco"); _staSuperBatleDroid1 = creature13; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature13.Prefab); Creature creature14 = new Creature("starwarsmobs", "STA_WEEQUAYHUNTER") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 8f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature14.Localize().English("Weequay Hunter").Spanish("Cazador Weequay"); _staWeequayHunter = creature14; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature14.Prefab); Creature creature15 = new Creature("starwarsmobs", "STA_EMBO") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 4f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature15.Localize().English("Embo").Spanish("Embo"); _staEmbo = creature15; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature15.Prefab); Creature creature16 = new Creature("starwarsmobs", "STA_DUROSHUNTER") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 8f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature16.Localize().English("Duros Hunter").Spanish("Cazador Duros"); _staDurosHunter = creature16; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature16.Prefab); Creature creature17 = new Creature("starwarsmobs", "STA_IMPERIALGUNNER") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1500, SpawnChance = 7f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature17.Localize().English("Imperial Gunner").Spanish("Artillero imperial"); _staImperialGunner = creature17; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature17.Prefab); Creature creature18 = new Creature("starwarsmobs", "STA_CADBANE") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 4f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature18.Localize().English("Cad Bane").Spanish("Cad Bane"); _staCadBane = creature18; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature18.Prefab); Creature creature19 = new Creature("starwarsmobs", "STA_HONDO") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1500, SpawnChance = 6f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature19.Localize().English("Hondo").Spanish("Hondo"); _staHondo = creature19; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature19.Prefab); Creature creature20 = new Creature("starwarsmobs", "STA_TROOPERSNOW") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)5, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(100f, 2000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)4, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 8f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature20.Localize().English("Snowtrooper").Spanish("Soldado de nieve"); _staTrooperSnow = creature20; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature20.Prefab); Creature creature21 = new Creature("starwarsmobs", "STA_REBELTROOPER") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 8f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature21.Localize().English("Rebel Trooper").Spanish("Soldado rebelde"); _staRebelTrooper = creature21; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature21.Prefab); Creature creature22 = new Creature("starwarsmobs", "STA_REBELTROOPERV2") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1500, SpawnChance = 7f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature22.Localize().English("Rebel Trooper V2").Spanish("Soldado rebelde V2"); _staRebelTrooperV2 = creature22; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature22.Prefab); Creature creature23 = new Creature("starwarsmobs", "STA_CARADUNE") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature23.Localize().English("Cara Dune").Spanish("Cara Dune"); _staCaraDune = creature23; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature23.Prefab); Creature creature24 = new Creature("starwarsmobs", "STA_TUSKEN") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature24.Localize().English("Tusken Raider").Spanish("Incursor Tusken"); creature24.Drops["STA_TrophyTusken"].Amount = new CreatureManager.Range(1f, 1f); creature24.Drops["STA_TrophyTusken"].DropChance = 10f; _staTusken = creature24; MaterialReplacer.RegisterFurCreatureForShaderSwap(creature24.Prefab); Creature creature25 = new Creature("starwarsmobs", "STA_TUSKENMELEE") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature25.Localize().English("Tusken Melee Warrior").Spanish("Guerrero Tusken cuerpo a cuerpo"); creature25.Drops["STA_TrophyTusken"].Amount = new CreatureManager.Range(1f, 1f); creature25.Drops["STA_TrophyTusken"].DropChance = 10f; _staTuskenMelee = creature25; MaterialReplacer.RegisterFurCreatureForShaderSwap(creature25.Prefab); Creature creature26 = new Creature("starwarsmobs", "STA_JAWA") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 3f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature26.Localize().English("Jawa").Spanish("Jawa"); creature26.Drops["STA_TrophyJAWA"].Amount = new CreatureManager.Range(1f, 1f); creature26.Drops["STA_TrophyJAWA"].DropChance = 10f; _staJawa = creature26; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature26.Prefab); Creature creature27 = new Creature("starwarsmobs", "STA_GAMORREAN") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature27.Localize().English("Gamorrean").Spanish("Gamorreano"); creature27.Drops["STA_TrophyGAMORREAN"].Amount = new CreatureManager.Range(1f, 1f); creature27.Drops["STA_TrophyGAMORREAN"].DropChance = 10f; _staGamorrean = creature27; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature27.Prefab); Creature creature28 = new Creature("starwarsmobs", "STA_GAMORREANCAPITAN") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature28.Localize().English("Gamorrean Warrior").Spanish("Guerrero Gamorreano"); creature28.Drops["STA_TrophyGAMORREANCAPITAN"].Amount = new CreatureManager.Range(1f, 1f); creature28.Drops["STA_TrophyGAMORREANCAPITAN"].DropChance = 10f; _staGamorreanCaptain = creature28; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature28.Prefab); Creature creature29 = new Creature("starwarsmobs", "STA_NEUMONIANO") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature29.Localize().English("Neimoidian Warrior").Spanish("Guerrero Neimoidiano"); creature29.Drops["STA_TrophyNEUMONIANO"].Amount = new CreatureManager.Range(1f, 1f); creature29.Drops["STA_TrophyNEUMONIANO"].DropChance = 10f; _staNeumoniano = creature29; MaterialReplacer.RegisterFurCreatureForShaderSwap(creature29.Prefab); Creature creature30 = new Creature("starwarsmobs", "STA_YODAJEDI") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature30.Localize().English("Yoda Jedi Master").Spanish("Maestro Jedi Yoda"); creature30.Drops["STA_TrophyYODA"].Amount = new CreatureManager.Range(1f, 1f); creature30.Drops["STA_TrophyYODA"].DropChance = 10f; _staYodaJedi = creature30; MaterialReplacer.RegisterDoubleSidedUseUnityShader(creature30.Prefab); Creature creature31 = new Creature("starwarsmobs", "STA_EWOOK") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 3f), CheckSpawnInterval = 1200, SpawnChance = 15f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature31.Localize().English("Ewok").Spanish("Ewok"); creature31.Drops["STA_TrophyEWOOK"].Amount = new CreatureManager.Range(1f, 1f); creature31.Drops["STA_TrophyEWOOK"].DropChance = 10f; _staEwook = creature31; MaterialReplacer.RegisterFurCreatureForShaderSwap(creature31.Prefab); Creature creature32 = new Creature("starwarsmobs", "STA_EWOOKCHIEF") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature32.Localize().English("Ewok Chief").Spanish("Jefe Ewok"); creature32.Drops["STA_TrophyEWOOKCHIEF"].Amount = new CreatureManager.Range(1f, 1f); creature32.Drops["STA_TrophyEWOOKCHIEF"].DropChance = 10f; _staEwookChief = creature32; MaterialReplacer.RegisterFurCreatureForShaderSwap(creature32.Prefab); Creature creature33 = new Creature("starwarsmobs", "STA_EWOOKSCOUT") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 12f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature33.Localize().English("Ewok Scout").Spanish("Explorador Ewok"); creature33.Drops["STA_TrophyEWOOK"].Amount = new CreatureManager.Range(1f, 1f); creature33.Drops["STA_TrophyEWOOK"].DropChance = 10f; _staEwookScout = creature33; MaterialReplacer.RegisterFurCreatureForShaderSwap(creature33.Prefab); Creature creature34 = new Creature("starwarsmobs", "STA_EWOOKWARRIOR") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 12f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature34.Localize().English("Ewok Warrior").Spanish("Guerrero Ewok"); creature34.Drops["STA_TrophyEWOOK"].Amount = new CreatureManager.Range(1f, 1f); creature34.Drops["STA_TrophyEWOOK"].DropChance = 10f; _staEwookWarrior = creature34; MaterialReplacer.RegisterFurCreatureForShaderSwap(creature34.Prefab); Creature creature35 = new Creature("starwarsmobs", "STA_NEIMOIDIANVICEROY") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)7, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature35.Localize().English("Neimoidian Viceroy").Spanish("Virrey Neimoidiano"); creature35.Drops["STA_TrophyNEIMOIDIANVICEROY"].Amount = new CreatureManager.Range(1f, 1f); creature35.Drops["STA_TrophyNEIMOIDIANVICEROY"].DropChance = 10f; _staNeimoidianViceroy = creature35; MaterialReplacer.RegisterFurCreatureForShaderSwap(creature35.Prefab); Creature creature36 = new Creature("starwarsmobs", "STA_WAMPA") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)5, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(100f, 2000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)4, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature36.Localize().English("Wampa").Spanish("Wampa"); creature36.Drops["STA_TrophyWampa"].Amount = new CreatureManager.Range(1f, 1f); creature36.Drops["STA_TrophyWampa"].DropChance = 10f; _staWampa = creature36; MaterialReplacer.RegisterFurCreatureForShaderSwap(creature36.Prefab); Creature creature37 = new Creature("starwarsmobs", "STA_ADMIRALACKBAR") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature37.Localize().English("Admiral Ackbar").Spanish("Almirante Ackbar"); creature37.Drops["STA_TrophyADMIRALACKBAR"].Amount = new CreatureManager.Range(1f, 1f); creature37.Drops["STA_TrophyADMIRALACKBAR"].DropChance = 10f; _staAdmiralAckbar = creature37; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature37.Prefab); Creature creature38 = new Creature("starwarsmobs", "STA_CONCUBINEFEM") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature38.Localize().English("Female Concubine").Spanish("Concubina"); _staConcubineFem = creature38; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature38.Prefab); Creature creature39 = new Creature("starwarsmobs", "STA_CONCUBINEFEMB") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)2, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.Yes, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature39.Localize().English("Female Concubine Variant").Spanish("Concubina variante"); _staConcubineFemB = creature39; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature39.Prefab); Creature creature40 = new Creature("starwarsmobs", "STA_MACEWINDU") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature40.Localize().English("Jedi Master Mace Windu").Spanish("Maestro Jedi Mace Windu"); _staMaceWindu = creature40; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature40.Prefab); Creature creature41 = new Creature("starwarsmobs", "STA_MASTERKIADIMUNDI") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature41.Localize().English("Jedi Master Ki-Adi-Mundi").Spanish("Maestro Jedi Ki-Adi-Mundi"); _staMasterKiAdiMundi = creature41; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature41.Prefab); Creature creature42 = new Creature("starwarsmobs", "STA_MASTERKITFISTO") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature42.Localize().English("Jedi Master Kit Fisto").Spanish("Maestro Jedi Kit Fisto"); _staMasterKitFisto = creature42; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature42.Prefab); Creature creature43 = new Creature("starwarsmobs", "STA_MASTERPLOKON") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature43.Localize().English("Jedi Master Plo Koon").Spanish("Maestro Jedi Plo Koon"); _staMasterPloKon = creature43; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature43.Prefab); Creature creature44 = new Creature("starwarsmobs", "STA_MASTERQUIGONJINN") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature44.Localize().English("Jedi Master Qui-Gon Jinn").Spanish("Maestro Jedi Qui-Gon Jinn"); _staMasterQuiGonJinn = creature44; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature44.Prefab); Creature creature45 = new Creature("starwarsmobs", "STA_DARTHTYRANUS") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)4, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature45.Localize().English("Darth Tyranus").Spanish("Darth Tyranus"); _staDarthTyranus = creature45; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature45.Prefab); MaterialReplacer.RegisterEmbeddedLightsaberBlade(creature45.Prefab, new Color(1f, 0.04f, 0.015f)); Creature creature46 = new Creature("starwarsmobs", "STA_AsajjVentress") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)4, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature46.Localize().English("Asajj Ventress").Spanish("Asajj Ventress"); _staAsajjVentress = creature46; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature46.Prefab); MaterialReplacer.RegisterEmbeddedLightsaberBlade(creature46.Prefab, new Color(1f, 0.04f, 0.015f)); Creature creature47 = new Creature("starwarsmobs", "STA_DARTHSION") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)4, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1800, SpawnChance = 5f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 1 }; creature47.Localize().English("Darth Sion").Spanish("Darth Sion"); _staDarthSion = creature47; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature47.Prefab); Creature creature48 = new Creature("starwarsmobs", "STA_JEDI") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1500, SpawnChance = 8f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature48.Localize().English("Jedi Knight").Spanish("Caballero Jedi 1"); _staJedi = creature48; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature48.Prefab); Creature creature49 = new Creature("starwarsmobs", "STA_JEDI1") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1500, SpawnChance = 8f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature49.Localize().English("Veteran Jedi Knight").Spanish("Caballero Jedi veterano 1"); _staJedi1 = creature49; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature49.Prefab); Creature creature50 = new Creature("starwarsmobs", "STA_JEDI2") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1500, SpawnChance = 8f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature50.Localize().English("Jedi Knight").Spanish("Caballero Jedi 2"); _staJedi2 = creature50; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature50.Prefab); Creature creature51 = new Creature("starwarsmobs", "STA_JEDI3") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1500, SpawnChance = 8f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature51.Localize().English("Veteran Jedi Knight").Spanish("Caballero Jedi veterano"); _staJedi3 = creature51; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature51.Prefab); Creature creature52 = new Creature("starwarsmobs", "STA_JEDIPADAWAN") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature52.Localize().English("Jedi Padawan").Spanish("Padawan Jedi"); _staJediPadawan = creature52; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature52.Prefab); Creature creature53 = new Creature("starwarsmobs", "STA_JEDIPADAWAN1") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)9, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature53.Localize().English("Jedi Padawan Apprentice").Spanish("Aprendiz Padawan Jedi"); _staJediPadawan1 = creature53; MaterialReplacer.RegisterStarwarsCharacterMaterialFix(creature53.Prefab); Creature creature54 = new Creature("starwarsmobs", "STA_SITHACOLITYO") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)4, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 2f), CheckSpawnInterval = 1200, SpawnChance = 10f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 3 }; creature54.Localize().English("Sith Acolyte").Spanish("Acólito Sith"); _staSithAcolityo = creature54; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature54.Prefab); MaterialReplacer.RegisterEmbeddedLightsaberBlade(creature54.Prefab, new Color(1f, 0.04f, 0.015f)); Creature creature55 = new Creature("starwarsmobs", "STA_SITHACOLITYOBRUTE") { ConfigurationEnabled = true, CanSpawn = true, CanBeTamed = false, FoodItems = "", CreatureFaction = (Faction)4, SpecificSpawnTime = SpawnTime.Always, RequiredAltitude = new CreatureManager.Range(0f, 1000f), RequiredOceanDepth = default(CreatureManager.Range), RequiredGlobalKey = GlobalKey.None, Biome = (Biome)512, SpecificSpawnArea = SpawnArea.Everywhere, GroupSize = new CreatureManager.Range(1f, 1f), CheckSpawnInterval = 1500, SpawnChance = 7f, ForestSpawn = Forest.No, RequiredWeather = Weather.None, SpawnAltitude = 0f, CanHaveStars = true, AttackImmediately = true, Maximum = 2 }; creature55.Localize().English("Sith Acolyte Brute").Spanish("Acólito Sith bruto"); _staSithAcolityoBrute = creature55; MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(creature55.Prefab); MaterialReplacer.RegisterEmbeddedLightsaberBlade(creature55.Prefab, new Color(1f, 0.04f, 0.015f)); ApplyCreatureHealths(); ApplyCreatureRunSpeeds(); ApplyCreatureWalkSpeeds(); StarwarsMobAIProfiles.ApplyToLoadedStarwarsMobs(); StarwarsMobsItems.Register(this); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); SetupWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { StarwarsMobsLogger.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); ApplyCreatureHealths(); ApplyCreatureRunSpeeds(); ApplyCreatureWalkSpeeds(); } catch { StarwarsMobsLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); StarwarsMobsLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private void ApplyCreatureHealths() { ApplyHealth(_staWookiee, _staWookieeHealth.Value); ApplyHealth(_staWookiee1, _staWookiee1Health.Value); ApplyHealth(_staWookiee2, _staWookiee2Health.Value); ApplyHealth(_staWookiee3, _staWookiee3Health.Value); ApplyHealth(_staDurosFemale, _staDurosFemaleHealth.Value); ApplyHealth(_staDurosMale, _staDurosMaleHealth.Value); ApplyHealth(_staTwilekFemale, _staTwilekFemaleHealth.Value); ApplyHealth(_staTwilekMale, _staTwilekMaleHealth.Value); ApplyHealth(_staRodian, _staRodianHealth.Value); ApplyHealth(_staDroidBatle, _staDroidBatleHealth.Value); ApplyHealth(_staDroidBatle1, _staDroidBatle1Health.Value); ApplyHealth(_staSuperBatleDroid, _staSuperBatleDroidHealth.Value); ApplyHealth(_staSuperBatleDroid1, _staSuperBatleDroid1Health.Value); ApplyHealth(_staWeequayHunter, _staWeequayHunterHealth.Value); ApplyHealth(_staEmbo, _staEmboHealth.Value); ApplyHealth(_staDurosHunter, _staDurosHunterHealth.Value); ApplyHealth(_staImperialGunner, _staImperialGunnerHealth.Value); ApplyHealth(_staCadBane, _staCadBaneHealth.Value); ApplyHealth(_staHondo, _staHondoHealth.Value); ApplyHealth(_staTrooperSnow, _staTrooperSnowHealth.Value); ApplyHealth(_staRebelTrooper, _staRebelTrooperHealth.Value); ApplyHealth(_staRebelTrooperV2, _staRebelTrooperV2Health.Value); ApplyHealth(_staCaraDune, _staCaraDuneHealth.Value); ApplyHealth(_staTusken, _staTuskenHealth.Value); ApplyHealth(_staTuskenMelee, _staTuskenMeleeHealth.Value); ApplyHealth(_staJawa, _staJawaHealth.Value); ApplyHealth(_staGamorrean, _staGamorreanHealth.Value); ApplyHealth(_staGamorreanCaptain, _staGamorreanCaptainHealth.Value); ApplyHealth(_staNeumoniano, _staNeumonianoHealth.Value); ApplyHealth(_staYodaJedi, _staYodaJediHealth.Value); ApplyHealth(_staEwook, _staEwookHealth.Value); ApplyHealth(_staEwookChief, _staEwookChiefHealth.Value); ApplyHealth(_staEwookScout, _staEwookScoutHealth.Value); ApplyHealth(_staEwookWarrior, _staEwookWarriorHealth.Value); ApplyHealth(_staNeimoidianViceroy, _staNeimoidianViceroyHealth.Value); ApplyHealth(_staWampa, _staWampaHealth.Value); ApplyHealth(_staAdmiralAckbar, _staAdmiralAckbarHealth.Value); ApplyHealth(_staConcubineFem, _staConcubineFemHealth.Value); ApplyHealth(_staConcubineFemB, _staConcubineFemBHealth.Value); ApplyHealth(_staMaceWindu, _staMaceWinduHealth.Value); ApplyHealth(_staMasterKiAdiMundi, _staMasterKiAdiMundiHealth.Value); ApplyHealth(_staMasterKitFisto, _staMasterKitFistoHealth.Value); ApplyHealth(_staMasterPloKon, _staMasterPloKonHealth.Value); ApplyHealth(_staMasterQuiGonJinn, _staMasterQuiGonJinnHealth.Value); ApplyHealth(_staDarthTyranus, _staDarthTyranusHealth.Value); ApplyHealth(_staAsajjVentress, _staAsajjVentressHealth.Value); ApplyHealth(_staDarthSion, _staDarthSionHealth.Value); ApplyHealth(_staJedi, _staJediHealth.Value); ApplyHealth(_staJedi1, _staJedi1Health.Value); ApplyHealth(_staJedi2, _staJedi2Health.Value); ApplyHealth(_staJedi3, _staJedi3Health.Value); ApplyHealth(_staJediPadawan, _staJediPadawanHealth.Value); ApplyHealth(_staJediPadawan1, _staJediPadawan1Health.Value); ApplyHealth(_staSithAcolityo, _staSithAcolityoHealth.Value); ApplyHealth(_staSithAcolityoBrute, _staSithAcolityoBruteHealth.Value); } private void ApplyCreatureRunSpeeds() { ApplyRunSpeed(_staWookiee, _staWookieeRunSpeed.Value); ApplyRunSpeed(_staWookiee1, _staWookiee1RunSpeed.Value); ApplyRunSpeed(_staWookiee2, _staWookiee2RunSpeed.Value); ApplyRunSpeed(_staWookiee3, _staWookiee3RunSpeed.Value); ApplyRunSpeed(_staDurosFemale, _staDurosFemaleRunSpeed.Value); ApplyRunSpeed(_staDurosMale, _staDurosMaleRunSpeed.Value); ApplyRunSpeed(_staTwilekFemale, _staTwilekFemaleRunSpeed.Value); ApplyRunSpeed(_staTwilekMale, _staTwilekMaleRunSpeed.Value); ApplyRunSpeed(_staRodian, _staRodianRunSpeed.Value); ApplyRunSpeed(_staDroidBatle, _staDroidBatleRunSpeed.Value); ApplyRunSpeed(_staDroidBatle1, _staDroidBatle1RunSpeed.Value); ApplyRunSpeed(_staSuperBatleDroid, _staSuperBatleDroidRunSpeed.Value); ApplyRunSpeed(_staSuperBatleDroid1, _staSuperBatleDroid1RunSpeed.Value); ApplyRunSpeed(_staWeequayHunter, _staWeequayHunterRunSpeed.Value); ApplyRunSpeed(_staEmbo, _staEmboRunSpeed.Value); ApplyRunSpeed(_staDurosHunter, _staDurosHunterRunSpeed.Value); ApplyRunSpeed(_staImperialGunner, _staImperialGunnerRunSpeed.Value); ApplyRunSpeed(_staCadBane, _staCadBaneRunSpeed.Value); ApplyRunSpeed(_staHondo, _staHondoRunSpeed.Value); ApplyRunSpeed(_staTrooperSnow, _staTrooperSnowRunSpeed.Value); ApplyRunSpeed(_staRebelTrooper, _staRebelTrooperRunSpeed.Value); ApplyRunSpeed(_staRebelTrooperV2, _staRebelTrooperV2RunSpeed.Value); ApplyRunSpeed(_staCaraDune, _staCaraDuneRunSpeed.Value); ApplyRunSpeed(_staTusken, _staTuskenRunSpeed.Value); ApplyRunSpeed(_staTuskenMelee, _staTuskenMeleeRunSpeed.Value); ApplyRunSpeed(_staJawa, _staJawaRunSpeed.Value); ApplyRunSpeed(_staGamorrean, _staGamorreanRunSpeed.Value); ApplyRunSpeed(_staGamorreanCaptain, _staGamorreanCaptainRunSpeed.Value); ApplyRunSpeed(_staNeumoniano, _staNeumonianoRunSpeed.Value); ApplyRunSpeed(_staYodaJedi, _staYodaJediRunSpeed.Value); ApplyRunSpeed(_staEwook, _staEwookRunSpeed.Value); ApplyRunSpeed(_staEwookChief, _staEwookChiefRunSpeed.Value); ApplyRunSpeed(_staEwookScout, _staEwookScoutRunSpeed.Value); ApplyRunSpeed(_staEwookWarrior, _staEwookWarriorRunSpeed.Value); ApplyRunSpeed(_staNeimoidianViceroy, _staNeimoidianViceroyRunSpeed.Value); ApplyRunSpeed(_staWampa, _staWampaRunSpeed.Value); ApplyRunSpeed(_staAdmiralAckbar, _staAdmiralAckbarRunSpeed.Value); ApplyRunSpeed(_staConcubineFem, _staConcubineFemRunSpeed.Value); ApplyRunSpeed(_staConcubineFemB, _staConcubineFemBRunSpeed.Value); ApplyRunSpeed(_staMaceWindu, _staMaceWinduRunSpeed.Value); ApplyRunSpeed(_staMasterKiAdiMundi, _staMasterKiAdiMundiRunSpeed.Value); ApplyRunSpeed(_staMasterKitFisto, _staMasterKitFistoRunSpeed.Value); ApplyRunSpeed(_staMasterPloKon, _staMasterPloKonRunSpeed.Value); ApplyRunSpeed(_staMasterQuiGonJinn, _staMasterQuiGonJinnRunSpeed.Value); ApplyRunSpeed(_staDarthTyranus, _staDarthTyranusRunSpeed.Value); ApplyRunSpeed(_staAsajjVentress, _staAsajjVentressRunSpeed.Value); ApplyRunSpeed(_staDarthSion, _staDarthSionRunSpeed.Value); ApplyRunSpeed(_staJedi, _staJediRunSpeed.Value); ApplyRunSpeed(_staJedi1, _staJedi1RunSpeed.Value); ApplyRunSpeed(_staJedi2, _staJedi2RunSpeed.Value); ApplyRunSpeed(_staJedi3, _staJedi3RunSpeed.Value); ApplyRunSpeed(_staJediPadawan, _staJediPadawanRunSpeed.Value); ApplyRunSpeed(_staJediPadawan1, _staJediPadawan1RunSpeed.Value); ApplyRunSpeed(_staSithAcolityo, _staSithAcolityoRunSpeed.Value); ApplyRunSpeed(_staSithAcolityoBrute, _staSithAcolityoBruteRunSpeed.Value); } private void ApplyCreatureWalkSpeeds() { ApplyWalkSpeed(_staWookiee, _staWookieeWalkSpeed.Value); ApplyWalkSpeed(_staWookiee1, _staWookiee1WalkSpeed.Value); ApplyWalkSpeed(_staWookiee2, _staWookiee2WalkSpeed.Value); ApplyWalkSpeed(_staWookiee3, _staWookiee3WalkSpeed.Value); ApplyWalkSpeed(_staDurosFemale, _staDurosFemaleWalkSpeed.Value); ApplyWalkSpeed(_staDurosMale, _staDurosMaleWalkSpeed.Value); ApplyWalkSpeed(_staTwilekFemale, _staTwilekFemaleWalkSpeed.Value); ApplyWalkSpeed(_staTwilekMale, _staTwilekMaleWalkSpeed.Value); ApplyWalkSpeed(_staRodian, _staRodianWalkSpeed.Value); ApplyWalkSpeed(_staDroidBatle, _staDroidBatleWalkSpeed.Value); ApplyWalkSpeed(_staDroidBatle1, _staDroidBatle1WalkSpeed.Value); ApplyWalkSpeed(_staSuperBatleDroid, _staSuperBatleDroidWalkSpeed.Value); ApplyWalkSpeed(_staSuperBatleDroid1, _staSuperBatleDroid1WalkSpeed.Value); ApplyWalkSpeed(_staWeequayHunter, _staWeequayHunterWalkSpeed.Value); ApplyWalkSpeed(_staEmbo, _staEmboWalkSpeed.Value); ApplyWalkSpeed(_staDurosHunter, _staDurosHunterWalkSpeed.Value); ApplyWalkSpeed(_staImperialGunner, _staImperialGunnerWalkSpeed.Value); ApplyWalkSpeed(_staCadBane, _staCadBaneWalkSpeed.Value); ApplyWalkSpeed(_staHondo, _staHondoWalkSpeed.Value); ApplyWalkSpeed(_staTrooperSnow, _staTrooperSnowWalkSpeed.Value); ApplyWalkSpeed(_staRebelTrooper, _staRebelTrooperWalkSpeed.Value); ApplyWalkSpeed(_staRebelTrooperV2, _staRebelTrooperV2WalkSpeed.Value); ApplyWalkSpeed(_staCaraDune, _staCaraDuneWalkSpeed.Value); ApplyWalkSpeed(_staTusken, _staTuskenWalkSpeed.Value); ApplyWalkSpeed(_staTuskenMelee, _staTuskenMeleeWalkSpeed.Value); ApplyWalkSpeed(_staJawa, _staJawaWalkSpeed.Value); ApplyWalkSpeed(_staGamorrean, _staGamorreanWalkSpeed.Value); ApplyWalkSpeed(_staGamorreanCaptain, _staGamorreanCaptainWalkSpeed.Value); ApplyWalkSpeed(_staNeumoniano, _staNeumonianoWalkSpeed.Value); ApplyWalkSpeed(_staYodaJedi, _staYodaJediWalkSpeed.Value); ApplyWalkSpeed(_staEwook, _staEwookWalkSpeed.Value); ApplyWalkSpeed(_staEwookChief, _staEwookChiefWalkSpeed.Value); ApplyWalkSpeed(_staEwookScout, _staEwookScoutWalkSpeed.Value); ApplyWalkSpeed(_staEwookWarrior, _staEwookWarriorWalkSpeed.Value); ApplyWalkSpeed(_staNeimoidianViceroy, _staNeimoidianViceroyWalkSpeed.Value); ApplyWalkSpeed(_staWampa, _staWampaWalkSpeed.Value); ApplyWalkSpeed(_staAdmiralAckbar, _staAdmiralAckbarWalkSpeed.Value); ApplyWalkSpeed(_staConcubineFem, _staConcubineFemWalkSpeed.Value); ApplyWalkSpeed(_staConcubineFemB, _staConcubineFemBWalkSpeed.Value); ApplyWalkSpeed(_staMaceWindu, _staMaceWinduWalkSpeed.Value); ApplyWalkSpeed(_staMasterKiAdiMundi, _staMasterKiAdiMundiWalkSpeed.Value); ApplyWalkSpeed(_staMasterKitFisto, _staMasterKitFistoWalkSpeed.Value); ApplyWalkSpeed(_staMasterPloKon, _staMasterPloKonWalkSpeed.Value); ApplyWalkSpeed(_staMasterQuiGonJinn, _staMasterQuiGonJinnWalkSpeed.Value); ApplyWalkSpeed(_staDarthTyranus, _staDarthTyranusWalkSpeed.Value); ApplyWalkSpeed(_staAsajjVentress, _staAsajjVentressWalkSpeed.Value); ApplyWalkSpeed(_staDarthSion, _staDarthSionWalkSpeed.Value); ApplyWalkSpeed(_staJedi, _staJediWalkSpeed.Value); ApplyWalkSpeed(_staJedi1, _staJedi1WalkSpeed.Value); ApplyWalkSpeed(_staJedi2, _staJedi2WalkSpeed.Value); ApplyWalkSpeed(_staJedi3, _staJedi3WalkSpeed.Value); ApplyWalkSpeed(_staJediPadawan, _staJediPadawanWalkSpeed.Value); ApplyWalkSpeed(_staJediPadawan1, _staJediPadawan1WalkSpeed.Value); ApplyWalkSpeed(_staSithAcolityo, _staSithAcolityoWalkSpeed.Value); ApplyWalkSpeed(_staSithAcolityoBrute, _staSithAcolityoBruteWalkSpeed.Value); } private void ApplyHealth(Creature creature, float health) { if (!((Object)(object)creature?.Prefab == (Object)null)) { Character component = creature.Prefab.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_health = health; } } } private void ApplyRunSpeed(Creature creature, float runSpeed) { if (!((Object)(object)creature?.Prefab == (Object)null)) { Character component = creature.Prefab.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_runSpeed = runSpeed; } } } private void ApplyWalkSpeed(Creature creature, float walkSpeed) { if (!((Object)(object)creature?.Prefab == (Object)null)) { Character component = creature.Prefab.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_walkSpeed = walkSpeed; } } } private ConfigEntry config(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry val2 = ((BaseUnityPlugin)this).Config.Bind(group, name, value, val); SyncedConfigEntry syncedConfigEntry = ConfigSync.AddConfigEntry(val2); syncedConfigEntry.SynchronizedConfig = synchronizedSetting; return val2; } private ConfigEntry config(string group, string name, T value, string description, bool synchronizedSetting = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty()), synchronizedSetting); } static StarwarsMobsPlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; ConnectionError = ""; StarwarsMobsLogger = Logger.CreateLogSource("StarwarsMobs"); ConfigSync = new ConfigSync("Azathoth.StarwarsMobs") { DisplayName = "StarwarsMobs", CurrentVersion = "1.0.0", MinimumRequiredVersion = "1.0.0" }; _staWookiee = null; _staWookiee1 = null; _staWookiee2 = null; _staWookiee3 = null; _staDurosFemale = null; _staDurosMale = null; _staTwilekFemale = null; _staTwilekMale = null; _staRodian = null; _staDroidBatle = null; _staDroidBatle1 = null; _staSuperBatleDroid = null; _staSuperBatleDroid1 = null; _staWeequayHunter = null; _staEmbo = null; _staDurosHunter = null; _staImperialGunner = null; _staCadBane = null; _staHondo = null; _staTrooperSnow = null; _staRebelTrooper = null; _staRebelTrooperV2 = null; _staCaraDune = null; _staTusken = null; _staTuskenMelee = null; _staJawa = null; _staGamorrean = null; _staGamorreanCaptain = null; _staNeumoniano = null; _staYodaJedi = null; _staEwook = null; _staEwookChief = null; _staEwookScout = null; _staEwookWarrior = null; _staNeimoidianViceroy = null; _staWampa = null; _staAdmiralAckbar = null; _staConcubineFem = null; _staConcubineFemB = null; _staMaceWindu = null; _staMasterKiAdiMundi = null; _staMasterKitFisto = null; _staMasterPloKon = null; _staMasterQuiGonJinn = null; _staDarthTyranus = null; _staAsajjVentress = null; _staDarthSion = null; _staJedi = null; _staJedi1 = null; _staJedi2 = null; _staJedi3 = null; _staJediPadawan = null; _staJediPadawan1 = null; _staSithAcolityo = null; _staSithAcolityoBrute = null; _serverConfigLocked = null; _staWookieeHealth = null; _staWookiee1Health = null; _staWookiee2Health = null; _staWookiee3Health = null; _staDurosFemaleHealth = null; _staDurosMaleHealth = null; _staTwilekFemaleHealth = null; _staTwilekMaleHealth = null; _staRodianHealth = null; _staDroidBatleHealth = null; _staDroidBatle1Health = null; _staSuperBatleDroidHealth = null; _staSuperBatleDroid1Health = null; _staWeequayHunterHealth = null; _staEmboHealth = null; _staDurosHunterHealth = null; _staImperialGunnerHealth = null; _staCadBaneHealth = null; _staHondoHealth = null; _staTrooperSnowHealth = null; _staRebelTrooperHealth = null; _staRebelTrooperV2Health = null; _staCaraDuneHealth = null; _staTuskenHealth = null; _staTuskenMeleeHealth = null; _staJawaHealth = null; _staGamorreanHealth = null; _staGamorreanCaptainHealth = null; _staNeumonianoHealth = null; _staYodaJediHealth = null; _staEwookHealth = null; _staEwookChiefHealth = null; _staEwookScoutHealth = null; _staEwookWarriorHealth = null; _staNeimoidianViceroyHealth = null; _staWampaHealth = null; _staAdmiralAckbarHealth = null; _staConcubineFemHealth = null; _staConcubineFemBHealth = null; _staMaceWinduHealth = null; _staMasterKiAdiMundiHealth = null; _staMasterKitFistoHealth = null; _staMasterPloKonHealth = null; _staMasterQuiGonJinnHealth = null; _staDarthTyranusHealth = null; _staAsajjVentressHealth = null; _staDarthSionHealth = null; _staJediHealth = null; _staJedi1Health = null; _staJedi2Health = null; _staJedi3Health = null; _staJediPadawanHealth = null; _staJediPadawan1Health = null; _staSithAcolityoHealth = null; _staSithAcolityoBruteHealth = null; _staWookieeRunSpeed = null; _staWookiee1RunSpeed = null; _staWookiee2RunSpeed = null; _staWookiee3RunSpeed = null; _staDurosFemaleRunSpeed = null; _staDurosMaleRunSpeed = null; _staTwilekFemaleRunSpeed = null; _staTwilekMaleRunSpeed = null; _staRodianRunSpeed = null; _staDroidBatleRunSpeed = null; _staDroidBatle1RunSpeed = null; _staSuperBatleDroidRunSpeed = null; _staSuperBatleDroid1RunSpeed = null; _staWeequayHunterRunSpeed = null; _staEmboRunSpeed = null; _staDurosHunterRunSpeed = null; _staImperialGunnerRunSpeed = null; _staCadBaneRunSpeed = null; _staHondoRunSpeed = null; _staTrooperSnowRunSpeed = null; _staRebelTrooperRunSpeed = null; _staRebelTrooperV2RunSpeed = null; _staCaraDuneRunSpeed = null; _staTuskenRunSpeed = null; _staTuskenMeleeRunSpeed = null; _staJawaRunSpeed = null; _staGamorreanRunSpeed = null; _staGamorreanCaptainRunSpeed = null; _staNeumonianoRunSpeed = null; _staYodaJediRunSpeed = null; _staEwookRunSpeed = null; _staEwookChiefRunSpeed = null; _staEwookScoutRunSpeed = null; _staEwookWarriorRunSpeed = null; _staNeimoidianViceroyRunSpeed = null; _staWampaRunSpeed = null; _staAdmiralAckbarRunSpeed = null; _staConcubineFemRunSpeed = null; _staConcubineFemBRunSpeed = null; _staMaceWinduRunSpeed = null; _staMasterKiAdiMundiRunSpeed = null; _staMasterKitFistoRunSpeed = null; _staMasterPloKonRunSpeed = null; _staMasterQuiGonJinnRunSpeed = null; _staDarthTyranusRunSpeed = null; _staAsajjVentressRunSpeed = null; _staDarthSionRunSpeed = null; _staJediRunSpeed = null; _staJedi1RunSpeed = null; _staJedi2RunSpeed = null; _staJedi3RunSpeed = null; _staJediPadawanRunSpeed = null; _staJediPadawan1RunSpeed = null; _staSithAcolityoRunSpeed = null; _staSithAcolityoBruteRunSpeed = null; _staWookieeWalkSpeed = null; _staWookiee1WalkSpeed = null; _staWookiee2WalkSpeed = null; _staWookiee3WalkSpeed = null; _staDurosFemaleWalkSpeed = null; _staDurosMaleWalkSpeed = null; _staTwilekFemaleWalkSpeed = null; _staTwilekMaleWalkSpeed = null; _staRodianWalkSpeed = null; _staDroidBatleWalkSpeed = null; _staDroidBatle1WalkSpeed = null; _staSuperBatleDroidWalkSpeed = null; _staSuperBatleDroid1WalkSpeed = null; _staWeequayHunterWalkSpeed = null; _staEmboWalkSpeed = null; _staDurosHunterWalkSpeed = null; _staImperialGunnerWalkSpeed = null; _staCadBaneWalkSpeed = null; _staHondoWalkSpeed = null; _staTrooperSnowWalkSpeed = null; _staRebelTrooperWalkSpeed = null; _staRebelTrooperV2WalkSpeed = null; _staCaraDuneWalkSpeed = null; _staTuskenWalkSpeed = null; _staTuskenMeleeWalkSpeed = null; _staJawaWalkSpeed = null; _staGamorreanWalkSpeed = null; _staGamorreanCaptainWalkSpeed = null; _staNeumonianoWalkSpeed = null; _staYodaJediWalkSpeed = null; _staEwookWalkSpeed = null; _staEwookChiefWalkSpeed = null; _staEwookScoutWalkSpeed = null; _staEwookWarriorWalkSpeed = null; _staNeimoidianViceroyWalkSpeed = null; _staWampaWalkSpeed = null; _staAdmiralAckbarWalkSpeed = null; _staConcubineFemWalkSpeed = null; _staConcubineFemBWalkSpeed = null; _staMaceWinduWalkSpeed = null; _staMasterKiAdiMundiWalkSpeed = null; _staMasterKitFistoWalkSpeed = null; _staMasterPloKonWalkSpeed = null; _staMasterQuiGonJinnWalkSpeed = null; _staDarthTyranusWalkSpeed = null; _staAsajjVentressWalkSpeed = null; _staDarthSionWalkSpeed = null; _staJediWalkSpeed = null; _staJedi1WalkSpeed = null; _staJedi2WalkSpeed = null; _staJedi3WalkSpeed = null; _staJediPadawanWalkSpeed = null; _staJediPadawan1WalkSpeed = null; _staSithAcolityoWalkSpeed = null; _staSithAcolityoBruteWalkSpeed = null; } } public static class KeyboardExtensions { public static bool IsKeyDown(this KeyboardShortcut shortcut) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return (int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey) && ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func)Input.GetKey); } public static bool IsKeyHeld(this KeyboardShortcut shortcut) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return (int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey) && ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func)Input.GetKey); } } [HarmonyPatch(typeof(Attack), "GetAttackOrigin")] internal static class SuperBattleDroidAttackOriginPatch { private static readonly Dictionary StableOrigins = new Dictionary(); private static readonly FieldInfo CharacterField = AccessTools.Field(typeof(Attack), "m_character"); private static void Postfix(Attack __instance, ref Transform __result) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (__instance == null || (Object)(object)__result == (Object)null) { return; } object? obj = CharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); Humanoid val2 = (Humanoid)(object)((val is Humanoid) ? val : null); if (val2 == null || !IsSuperBattleDroid(val2)) { return; } ItemData currentWeapon = val2.GetCurrentWeapon(); if (IsSuperBattleDroidGun(currentWeapon)) { Transform stableOrigin = GetStableOrigin(__instance, ((Component)val).transform); if (!((Object)(object)stableOrigin == (Object)null)) { stableOrigin.position = __result.position; stableOrigin.rotation = GetAimRotation(val2, stableOrigin.position); __result = stableOrigin; } } } private static Quaternion GetAimRotation(Humanoid humanoid, Vector3 origin) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) MonsterAI component = ((Component)humanoid).GetComponent(); Character val = ((component != null) ? ((BaseAI)component).GetTargetCreature() : null); if ((Object)(object)val != (Object)null && !CallBool(val, "IsDead")) { Vector3 val2 = val.GetCenterPoint() - origin; if (((Vector3)(ref val2)).sqrMagnitude > 0.001f) { return Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up); } } return ((Component)humanoid).transform.rotation; } private static Transform GetStableOrigin(Attack attack, Transform characterRoot) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (StableOrigins.TryGetValue(attack, out Transform value) && Object.op_Implicit((Object)(object)value)) { return value; } GameObject val = new GameObject("StarwarsSuperBattleDroidStableMuzzle"); val.transform.SetParent(characterRoot, true); ((Object)val).hideFlags = (HideFlags)61; value = val.transform; StableOrigins[attack] = value; return value; } private static bool IsSuperBattleDroid(Humanoid humanoid) { string text = StarwarsMobMarkers.CleanName(((Object)((Component)humanoid).gameObject).name); return text.StartsWith("STA_SUPERBATLEDROID", StringComparison.OrdinalIgnoreCase); } private static bool IsSuperBattleDroidGun(ItemData weapon) { object obj; if (weapon == null) { obj = null; } else { GameObject dropPrefab = weapon.m_dropPrefab; obj = ((dropPrefab != null) ? ((Object)dropPrefab).name : null); } if (obj == null) { obj = string.Empty; } string name = (string)obj; string a = StarwarsMobMarkers.CleanName(name); return string.Equals(a, "SUPERBATLEDROIDATTACK", StringComparison.OrdinalIgnoreCase) || string.Equals(a, "SUPERBATLEDROIDATTACK1", StringComparison.OrdinalIgnoreCase); } private static bool CallBool(object instance, string methodName) { MethodInfo methodInfo = AccessTools.Method(instance.GetType(), methodName, (Type[])null, (Type[])null); return methodInfo != null && methodInfo.ReturnType == typeof(bool) && (bool)methodInfo.Invoke(instance, null); } } [HarmonyPatch(typeof(Projectile), "Setup")] internal static class SuperBattleDroidProjectileAimPatch { private static readonly Dictionary NextLeftMuzzleByDroid = new Dictionary(); private static void Prefix(Projectile __instance, Character owner, ref Vector3 velocity) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } Humanoid val = (Humanoid)(object)((owner is Humanoid) ? owner : null); if (val == null || !IsSuperBattleDroid(val)) { return; } if (UsesDualMuzzleAttack(val)) { Transform nextMuzzle = GetNextMuzzle(val); if ((Object)(object)nextMuzzle != (Object)null) { ((Component)__instance).transform.position = nextMuzzle.position; } } MonsterAI component = ((Component)val).GetComponent(); Character val2 = ((component != null) ? ((BaseAI)component).GetTargetCreature() : null); if ((Object)(object)val2 == (Object)null || IsDead(val2)) { return; } Vector3 val3 = val2.GetCenterPoint() - ((Component)__instance).transform.position; if (!(((Vector3)(ref val3)).sqrMagnitude < 0.001f)) { float num = ((Vector3)(ref velocity)).magnitude; if (num < 0.01f) { num = 40f; } velocity = ((Vector3)(ref val3)).normalized * num; __instance.m_gravity = 0f; } } private static bool UsesDualMuzzleAttack(Humanoid humanoid) { ItemData currentWeapon = humanoid.GetCurrentWeapon(); object name; if (currentWeapon == null) { name = null; } else { GameObject dropPrefab = currentWeapon.m_dropPrefab; name = ((dropPrefab != null) ? ((Object)dropPrefab).name : null); } string a = StarwarsMobMarkers.CleanName((string)name); return string.Equals(a, "SUPERBATLEDROIDATTACK1", StringComparison.OrdinalIgnoreCase); } private static Transform GetNextMuzzle(Humanoid humanoid) { int instanceID = ((Object)humanoid).GetInstanceID(); bool value; bool flag = NextLeftMuzzleByDroid.TryGetValue(instanceID, out value) && value; NextLeftMuzzleByDroid[instanceID] = !flag; Transform val = FindChildByName(((Component)humanoid).transform, flag ? "muzzle.l" : "muzzle.r"); return val ?? FindChildByName(((Component)humanoid).transform, flag ? "muzzle.r" : "muzzle.l"); } private static Transform FindChildByName(Transform root, string childName) { Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (string.Equals(((Object)val).name, childName, StringComparison.OrdinalIgnoreCase)) { return val; } } return null; } private static bool IsSuperBattleDroid(Humanoid humanoid) { string text = StarwarsMobMarkers.CleanName(((Object)((Component)humanoid).gameObject).name); return text.StartsWith("STA_SUPERBATLEDROID", StringComparison.OrdinalIgnoreCase); } private static bool IsDead(Character character) { MethodInfo methodInfo = AccessTools.Method(((object)character).GetType(), "IsDead", (Type[])null, (Type[])null); return methodInfo != null && methodInfo.ReturnType == typeof(bool) && (bool)methodInfo.Invoke(character, null); } } [HarmonyPatch(typeof(Humanoid), "StartAttack")] internal static class StarwarsMobHumanoidStartAttackPatch { private static void Prefix(Humanoid __instance, ref bool secondaryAttack) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null || !StarwarsMobMarkers.IsSupportedMob(((Component)__instance).gameObject) || IsBusy(__instance)) { return; } ItemData currentWeapon = __instance.GetCurrentWeapon(); if (currentWeapon == null || currentWeapon.m_shared == null) { return; } bool flag = currentWeapon.HavePrimaryAttack(); if (currentWeapon.HaveSecondaryAttack()) { bool flag2 = !flag || Random.value > 0.5f; if ((int)currentWeapon.m_shared.m_skillType == 5) { flag2 = false; } if (flag2) { secondaryAttack = true; } } } private static void Postfix(Humanoid __instance, bool __result) { if (__result && !((Object)(object)__instance == (Object)null) && StarwarsMobMarkers.IsSupportedMob(((Component)__instance).gameObject)) { ItemData currentWeapon = __instance.GetCurrentWeapon(); if (currentWeapon?.m_shared != null) { ResetReloadStateForMobWeapon(__instance, currentWeapon); ResetBowDrawForMobWeapon(currentWeapon); } } } private static bool IsBusy(Humanoid humanoid) { return (CallBool(humanoid, "InAttack") && !CallBool(humanoid, "HaveQueuedChain")) || CallBool(humanoid, "InDodge") || !CallBool(humanoid, "CanMove", fallback: true) || CallBool(humanoid, "IsKnockedBack") || CallBool(humanoid, "IsStaggering") || CallBool(humanoid, "InMinorAction"); } private static void ResetReloadStateForMobWeapon(Humanoid humanoid, ItemData weapon) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 try { Attack attack = weapon.m_shared.m_attack; if (attack == null || !attack.m_requiresReload || (int)weapon.m_shared.m_skillType == 14) { return; } ZNetView nview = ((Character)humanoid).m_nview; if ((Object)(object)nview != (Object)null && nview.IsValid()) { ZDO zDO = nview.GetZDO(); if (zDO != null) { zDO.Set(ZDOVars.s_weaponLoaded, false); } } AccessTools.Field(((object)humanoid).GetType(), "m_weaponLoaded")?.SetValue(humanoid, null); } catch (Exception ex) { StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)("Starwars mob reload reset skipped: " + ex.Message)); } } private static void ResetBowDrawForMobWeapon(ItemData weapon) { try { Attack attack = weapon.m_shared.m_attack; if (attack != null && attack.m_bowDraw) { attack.m_attackDrawPercentage = 0f; } } catch (Exception ex) { StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)("Starwars mob bow draw reset skipped: " + ex.Message)); } } private static bool CallBool(object instance, string methodName, bool fallback = false) { try { MethodInfo methodInfo = AccessTools.Method(instance.GetType(), methodName, Type.EmptyTypes, (Type[])null); if (methodInfo == null || methodInfo.ReturnType != typeof(bool)) { return fallback; } return (bool)methodInfo.Invoke(instance, null); } catch { return fallback; } } } [HarmonyPatch(typeof(Attack), "HaveAmmo")] internal static class StarwarsMobAttackHaveAmmoPatch { private static void Postfix(Humanoid character, ref bool __result) { if (!__result && !((Object)(object)character == (Object)null) && StarwarsMobMarkers.IsSupportedMob(((Component)character).gameObject)) { __result = true; } } } [HarmonyPatch(typeof(Attack), "FindAmmo")] internal static class StarwarsMobAttackFindAmmoPatch { private static void Postfix(Humanoid character, ItemData weapon, ref ItemData __result) { if (__result != null || (Object)(object)character == (Object)null || weapon?.m_shared == null || !StarwarsMobMarkers.IsSupportedMob(((Component)character).gameObject) || string.IsNullOrWhiteSpace(weapon.m_shared.m_ammoType) || character.m_inventory == null) { return; } string text = ResolveAmmoPrefabName(weapon.m_shared.m_ammoType); if (string.IsNullOrWhiteSpace(text)) { return; } try { ItemData val = character.m_inventory.AddItem(text, 10, 1, 0, 0L, "", false); if (val != null) { __result = val; } } catch (Exception ex) { StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)("Starwars mob ammo injection skipped: " + ex.Message)); } } private static string ResolveAmmoPrefabName(string ammoType) { if (!(ammoType == "$ammo_arrows")) { if (ammoType == "$ammo_bolts") { return "BoltBone"; } string text = ammoType.ToLowerInvariant(); if (text.Contains("arrow")) { return "ArrowWood"; } if (text.Contains("bolt")) { return "BoltBone"; } return string.Empty; } return "ArrowWood"; } } [HarmonyPatch(typeof(Attack), "Start")] internal static class StarwarsMobAttackStartPatch { private static void Prefix(Attack __instance, Character character, ref float attackDrawPercentage) { if (__instance == null || (Object)(object)character == (Object)null) { return; } StarwarsMobAIProfiles.ReactToPlayerAttack(character, __instance); Humanoid val = (Humanoid)(object)((character is Humanoid) ? character : null); if (val == null || !StarwarsMobMarkers.IsSupportedMob(((Component)val).gameObject)) { return; } if (IsSuperBattleDroidDualCannon(val)) { __instance.m_projectileBursts = 2; __instance.m_burstInterval = 0f; } if (!__instance.m_bowDraw) { return; } attackDrawPercentage = 1f; try { __instance.m_attackDrawPercentage = 0f; } catch (Exception ex) { StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)("Starwars mob bow draw force skipped: " + ex.Message)); } } private static bool IsSuperBattleDroidDualCannon(Humanoid humanoid) { string text = StarwarsMobMarkers.CleanName(((Object)((Component)humanoid).gameObject).name); if (!text.StartsWith("STA_SUPERBATLEDROID", StringComparison.OrdinalIgnoreCase)) { return false; } ItemData currentWeapon = humanoid.GetCurrentWeapon(); object name; if (currentWeapon == null) { name = null; } else { GameObject dropPrefab = currentWeapon.m_dropPrefab; name = ((dropPrefab != null) ? ((Object)dropPrefab).name : null); } string a = StarwarsMobMarkers.CleanName((string)name); return string.Equals(a, "SUPERBATLEDROIDATTACK1", StringComparison.OrdinalIgnoreCase); } } internal enum StarwarsMobAIProfile { WookieeGuardian, RefugeeSkirmisher, ForestSkirmisher, RodianHunter, BattleDroid, YellowBattleDroid, SuperBattleDroid, WhiteSuperBattleDroid, WeequayHunter, BountyHunter, DurosHunter, ImperialGunner, CadBane, Hondo, SnowTrooper, RebelTrooper, RebelTrooperV2, CaraDune, TuskenMarksman, TuskenRaider, JawaScavenger, GamorreanBruiser, GamorreanCaptain, NeimoidianOfficer, YodaDuelist, EwokTrickster, EwokChief, EwokScout, EwokWarrior, WampaPredator, RebelCommander, BlackForestAmbusher, JediPadawan, JediKnight, JediVeteran, JediMaster, SithAcolyte, SithBrute, SithAssassin, SithLord, SithJuggernaut } internal static class StarwarsMobAIProfiles { [Flags] private enum CombatBehavior { None = 0, KiteWhenCrowded = 1, LowHealthFrenzy = 2, LowHealthFear = 4, DuelistFootwork = 8, BossPhase = 0x10, ReactiveDodge = 0x20 } private readonly struct BehaviorSettings { public readonly CombatBehavior Behaviors; public readonly float KiteStartDistance; public readonly float KiteStepDistance; public readonly float KiteCooldown; public readonly float FearHealthThreshold; public readonly float FrenzyHealthThreshold; public readonly float FrenzySpeedMultiplier; public readonly float DuelMinDistance; public readonly float DuelMaxDistance; public readonly float DuelStepDuration; public readonly float DuelStepCooldown; public readonly float BossPhaseHealthThreshold; public readonly float BossSpeedMultiplier; public readonly float BossChaseDistance; public readonly float BossAlertRange; public readonly float DodgeChance; public readonly float DodgeCooldown; public readonly float DodgeRange; public readonly float DodgeStepDistance; public readonly float DodgeDuration; private BehaviorSettings(CombatBehavior behaviors, float kiteStartDistance, float kiteStepDistance, float kiteCooldown, float fearHealthThreshold, float frenzyHealthThreshold, float frenzySpeedMultiplier, float duelMinDistance, float duelMaxDistance, float duelStepDuration, float duelStepCooldown, float bossPhaseHealthThreshold, float bossSpeedMultiplier, float bossChaseDistance, float bossAlertRange, float dodgeChance, float dodgeCooldown, float dodgeRange, float dodgeStepDistance, float dodgeDuration) { Behaviors = behaviors; KiteStartDistance = kiteStartDistance; KiteStepDistance = kiteStepDistance; KiteCooldown = kiteCooldown; FearHealthThreshold = fearHealthThreshold; FrenzyHealthThreshold = frenzyHealthThreshold; FrenzySpeedMultiplier = frenzySpeedMultiplier; DuelMinDistance = duelMinDistance; DuelMaxDistance = duelMaxDistance; DuelStepDuration = duelStepDuration; DuelStepCooldown = duelStepCooldown; BossPhaseHealthThreshold = bossPhaseHealthThreshold; BossSpeedMultiplier = bossSpeedMultiplier; BossChaseDistance = bossChaseDistance; BossAlertRange = bossAlertRange; DodgeChance = dodgeChance; DodgeCooldown = dodgeCooldown; DodgeRange = dodgeRange; DodgeStepDistance = dodgeStepDistance; DodgeDuration = dodgeDuration; } public static BehaviorSettings Kiter(float startDistance, float stepDistance) { return new BehaviorSettings(CombatBehavior.KiteWhenCrowded, startDistance, stepDistance, 1.2f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0.5f, 1.15f, 105f, 48f, 0f, 0f, 0f, 0f, 0f); } public static BehaviorSettings Fearful(float healthThreshold) { return new BehaviorSettings(CombatBehavior.LowHealthFear, 0f, 0f, 0f, healthThreshold, 0f, 1f, 0f, 0f, 0f, 0f, 0.5f, 1.15f, 105f, 48f, 0f, 0f, 0f, 0f, 0f); } public static BehaviorSettings FearfulKiter(float startDistance, float stepDistance, float healthThreshold) { BehaviorSettings behaviorSettings = Kiter(startDistance, stepDistance); return behaviorSettings.With(behaviorSettings.Behaviors | CombatBehavior.LowHealthFear, healthThreshold); } public static BehaviorSettings Frenzied(float healthThreshold) { return new BehaviorSettings(CombatBehavior.LowHealthFrenzy, 0f, 0f, 0f, 0f, healthThreshold, 1.18f, 0f, 0f, 0f, 0f, 0.5f, 1.15f, 105f, 48f, 0f, 0f, 0f, 0f, 0f); } public static BehaviorSettings Duelist() { return new BehaviorSettings(CombatBehavior.DuelistFootwork, 0f, 0f, 0f, 0f, 0f, 1f, 2.2f, 7.2f, 0.22f, 2.6f, 0.5f, 1.15f, 105f, 48f, 0f, 0f, 0f, 0f, 0f); } public bool Has(CombatBehavior behavior) { return (Behaviors & behavior) == behavior; } public BehaviorSettings WithFrenzy(float healthThreshold) { CombatBehavior? behaviors = Behaviors | CombatBehavior.LowHealthFrenzy; float? frenzyHealthThreshold = healthThreshold; return With(behaviors, null, frenzyHealthThreshold); } public BehaviorSettings WithBossPhase() { return With(Behaviors | CombatBehavior.BossPhase); } public BehaviorSettings WithDodge(float chance, float cooldown, float range, float stepDistance) { CombatBehavior? behaviors = Behaviors | CombatBehavior.ReactiveDodge; float? dodgeChance = chance; float? dodgeCooldown = cooldown; float? dodgeRange = range; float? dodgeStepDistance = stepDistance; float? dodgeDuration = 0.28f; return With(behaviors, null, null, dodgeChance, dodgeCooldown, dodgeRange, dodgeStepDistance, dodgeDuration); } private BehaviorSettings With(CombatBehavior? behaviors = null, float? fearHealthThreshold = null, float? frenzyHealthThreshold = null, float? dodgeChance = null, float? dodgeCooldown = null, float? dodgeRange = null, float? dodgeStepDistance = null, float? dodgeDuration = null) { return new BehaviorSettings(behaviors ?? Behaviors, KiteStartDistance, KiteStepDistance, KiteCooldown, fearHealthThreshold ?? FearHealthThreshold, frenzyHealthThreshold ?? FrenzyHealthThreshold, FrenzySpeedMultiplier, DuelMinDistance, DuelMaxDistance, DuelStepDuration, DuelStepCooldown, BossPhaseHealthThreshold, BossSpeedMultiplier, BossChaseDistance, BossAlertRange, dodgeChance ?? DodgeChance, dodgeCooldown ?? DodgeCooldown, dodgeRange ?? DodgeRange, dodgeStepDistance ?? DodgeStepDistance, dodgeDuration ?? DodgeDuration); } } private sealed class BehaviorState { public bool HasBaseState; public float BaseRunSpeed; public float BaseWalkSpeed; public float BaseMinAttackInterval; public float BaseMaxChaseDistance; public float BaseAlertRange; public bool BaseEnableHuntPlayer; public bool BaseFleeIfNotAlerted; public float BaseFleeIfLowHealth; public float BaseFleeRange; public float BaseFleeInterval; public float NextKiteTime; public float NextDuelistMoveTime; public float DuelistMoveUntil; public float DuelistDirection = 1f; public Vector3 DuelistMoveDirection; public float NextDodgeTime; public float DodgeMoveUntil; public Vector3 DodgePoint; public Vector3 DodgeLookAt; } private static readonly Dictionary ProfilesByPrefabName = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["STA_Wookiee"] = StarwarsMobAIProfile.WookieeGuardian, ["STA_Wookiee1"] = StarwarsMobAIProfile.WookieeGuardian, ["STA_Wookiee2"] = StarwarsMobAIProfile.WookieeGuardian, ["STA_Wookiee3"] = StarwarsMobAIProfile.WookieeGuardian, ["STA_DUROSFEMALE"] = StarwarsMobAIProfile.RefugeeSkirmisher, ["STA_DUROSMALE"] = StarwarsMobAIProfile.RefugeeSkirmisher, ["STA_TWILEKFEMALE"] = StarwarsMobAIProfile.ForestSkirmisher, ["STA_TWILEKMALE"] = StarwarsMobAIProfile.ForestSkirmisher, ["STA_RODIAN"] = StarwarsMobAIProfile.RodianHunter, ["STA_DROIDBATLE"] = StarwarsMobAIProfile.BattleDroid, ["STA_DROIDBATLE1"] = StarwarsMobAIProfile.YellowBattleDroid, ["STA_SUPERBATLEDROID"] = StarwarsMobAIProfile.SuperBattleDroid, ["STA_SUPERBATLEDROID1"] = StarwarsMobAIProfile.WhiteSuperBattleDroid, ["STA_WEEQUAYHUNTER"] = StarwarsMobAIProfile.WeequayHunter, ["STA_EMBO"] = StarwarsMobAIProfile.BountyHunter, ["STA_DUROSHUNTER"] = StarwarsMobAIProfile.DurosHunter, ["STA_IMPERIALGUNNER"] = StarwarsMobAIProfile.ImperialGunner, ["STA_CADBANE"] = StarwarsMobAIProfile.CadBane, ["STA_HONDO"] = StarwarsMobAIProfile.Hondo, ["STA_TROOPERSNOW"] = StarwarsMobAIProfile.SnowTrooper, ["STA_REBELTROOPER"] = StarwarsMobAIProfile.RebelTrooper, ["STA_REBELTROOPERV2"] = StarwarsMobAIProfile.RebelTrooperV2, ["STA_CARADUNE"] = StarwarsMobAIProfile.CaraDune, ["STA_TUSKEN"] = StarwarsMobAIProfile.TuskenMarksman, ["STA_TUSKENMELEE"] = StarwarsMobAIProfile.TuskenRaider, ["STA_JAWA"] = StarwarsMobAIProfile.JawaScavenger, ["STA_GAMORREAN"] = StarwarsMobAIProfile.GamorreanBruiser, ["STA_GAMORREANCAPITAN"] = StarwarsMobAIProfile.GamorreanCaptain, ["STA_NEUMONIANO"] = StarwarsMobAIProfile.NeimoidianOfficer, ["STA_YODAJEDI"] = StarwarsMobAIProfile.YodaDuelist, ["STA_EWOOK"] = StarwarsMobAIProfile.EwokTrickster, ["STA_EWOOKCHIEF"] = StarwarsMobAIProfile.EwokChief, ["STA_EWOOKSCOUT"] = StarwarsMobAIProfile.EwokScout, ["STA_EWOOKWARRIOR"] = StarwarsMobAIProfile.EwokWarrior, ["STA_NEIMOIDIANVICEROY"] = StarwarsMobAIProfile.NeimoidianOfficer, ["STA_WAMPA"] = StarwarsMobAIProfile.WampaPredator, ["STA_ADMIRALACKBAR"] = StarwarsMobAIProfile.RebelCommander, ["STA_CONCUBINEFEM"] = StarwarsMobAIProfile.BlackForestAmbusher, ["STA_CONCUBINEFEMB"] = StarwarsMobAIProfile.BlackForestAmbusher, ["STA_MACEWINDU"] = StarwarsMobAIProfile.JediMaster, ["STA_MASTERKIADIMUNDI"] = StarwarsMobAIProfile.JediMaster, ["STA_MASTERKITFISTO"] = StarwarsMobAIProfile.JediMaster, ["STA_MASTERPLOKON"] = StarwarsMobAIProfile.JediMaster, ["STA_MASTERQUIGONJINN"] = StarwarsMobAIProfile.JediMaster, ["STA_DARTHTYRANUS"] = StarwarsMobAIProfile.SithLord, ["STA_AsajjVentress"] = StarwarsMobAIProfile.SithAssassin, ["STA_DARTHSION"] = StarwarsMobAIProfile.SithJuggernaut, ["STA_JEDI"] = StarwarsMobAIProfile.JediKnight, ["STA_JEDI1"] = StarwarsMobAIProfile.JediVeteran, ["STA_JEDI2"] = StarwarsMobAIProfile.JediKnight, ["STA_JEDI3"] = StarwarsMobAIProfile.JediVeteran, ["STA_JEDIPADAWAN"] = StarwarsMobAIProfile.JediPadawan, ["STA_JEDIPADAWAN1"] = StarwarsMobAIProfile.JediPadawan, ["STA_SITHACOLITYO"] = StarwarsMobAIProfile.SithAcolyte, ["STA_SITHACOLITYOBRUTE"] = StarwarsMobAIProfile.SithBrute }; private static readonly Dictionary BehaviorByProfile = new Dictionary { [StarwarsMobAIProfile.RefugeeSkirmisher] = BehaviorSettings.FearfulKiter(7f, 15f, 0.38f), [StarwarsMobAIProfile.ForestSkirmisher] = BehaviorSettings.FearfulKiter(6.5f, 14f, 0.32f), [StarwarsMobAIProfile.RodianHunter] = BehaviorSettings.Kiter(8f, 18f), [StarwarsMobAIProfile.BattleDroid] = BehaviorSettings.Kiter(7.2f, 17f), [StarwarsMobAIProfile.YellowBattleDroid] = BehaviorSettings.Kiter(7.8f, 18f).WithDodge(0.12f, 2.4f, 4f, 3f), [StarwarsMobAIProfile.WeequayHunter] = BehaviorSettings.Kiter(8.5f, 19f).WithDodge(0.18f, 2.2f, 4.5f, 3.2f), [StarwarsMobAIProfile.BountyHunter] = BehaviorSettings.Kiter(9f, 22f).WithDodge(0.45f, 1.4f, 5f, 4f).WithBossPhase(), [StarwarsMobAIProfile.DurosHunter] = BehaviorSettings.Kiter(7.5f, 17f), [StarwarsMobAIProfile.ImperialGunner] = BehaviorSettings.Kiter(8.5f, 21f), [StarwarsMobAIProfile.CadBane] = BehaviorSettings.Kiter(9.5f, 24f).WithDodge(0.55f, 1.2f, 5.5f, 4.5f).WithBossPhase(), [StarwarsMobAIProfile.Hondo] = BehaviorSettings.Kiter(8.5f, 20f).WithDodge(0.25f, 1.8f, 4.6f, 3.6f), [StarwarsMobAIProfile.SnowTrooper] = BehaviorSettings.Kiter(9f, 22f), [StarwarsMobAIProfile.RebelTrooper] = BehaviorSettings.Kiter(8f, 20f), [StarwarsMobAIProfile.RebelTrooperV2] = BehaviorSettings.Kiter(8.5f, 21f).WithDodge(0.16f, 2f, 4.5f, 3.5f), [StarwarsMobAIProfile.CaraDune] = BehaviorSettings.Kiter(8.8f, 22f).WithDodge(0.34f, 1.6f, 5f, 4f).WithBossPhase(), [StarwarsMobAIProfile.TuskenMarksman] = BehaviorSettings.Kiter(9f, 22f), [StarwarsMobAIProfile.JawaScavenger] = BehaviorSettings.FearfulKiter(7f, 16f, 0.55f), [StarwarsMobAIProfile.NeimoidianOfficer] = BehaviorSettings.FearfulKiter(7.5f, 16f, 0.45f), [StarwarsMobAIProfile.EwokScout] = BehaviorSettings.Kiter(6f, 15f), [StarwarsMobAIProfile.RebelCommander] = BehaviorSettings.Kiter(8f, 20f).WithBossPhase(), [StarwarsMobAIProfile.BlackForestAmbusher] = BehaviorSettings.Fearful(0.35f), [StarwarsMobAIProfile.GamorreanBruiser] = BehaviorSettings.Frenzied(0.35f), [StarwarsMobAIProfile.GamorreanCaptain] = BehaviorSettings.Frenzied(0.4f).WithBossPhase(), [StarwarsMobAIProfile.WampaPredator] = BehaviorSettings.Frenzied(0.45f).WithBossPhase(), [StarwarsMobAIProfile.YodaDuelist] = BehaviorSettings.Duelist().WithDodge(0.78f, 1f, 5.4f, 5f).WithBossPhase(), [StarwarsMobAIProfile.JediPadawan] = BehaviorSettings.Duelist().WithDodge(0.18f, 1.8f, 4.4f, 3.4f), [StarwarsMobAIProfile.JediKnight] = BehaviorSettings.Duelist().WithDodge(0.38f, 1.45f, 4.8f, 4f), [StarwarsMobAIProfile.JediVeteran] = BehaviorSettings.Duelist().WithDodge(0.55f, 1.25f, 5.1f, 4.4f).WithBossPhase(), [StarwarsMobAIProfile.JediMaster] = BehaviorSettings.Duelist().WithDodge(0.7f, 1.05f, 5.4f, 5f).WithBossPhase(), [StarwarsMobAIProfile.SithAcolyte] = BehaviorSettings.Duelist().WithDodge(0.35f, 1.4f, 4.8f, 4f).WithFrenzy(0.35f), [StarwarsMobAIProfile.SithBrute] = BehaviorSettings.Frenzied(0.45f), [StarwarsMobAIProfile.SithAssassin] = BehaviorSettings.Duelist().WithDodge(0.8f, 0.9f, 5.8f, 5.4f).WithFrenzy(0.4f) .WithBossPhase(), [StarwarsMobAIProfile.SithLord] = BehaviorSettings.Duelist().WithDodge(0.72f, 1f, 5.5f, 5f).WithFrenzy(0.45f) .WithBossPhase(), [StarwarsMobAIProfile.SithJuggernaut] = BehaviorSettings.Frenzied(0.5f).WithBossPhase() }; private static readonly Dictionary BehaviorStates = new Dictionary(); public static void ApplyToLoadedStarwarsMobs() { BaseAI[] array = Resources.FindObjectsOfTypeAll(); foreach (BaseAI ai in array) { Apply(ai); } } public static void Apply(BaseAI ai) { if (!((Object)(object)ai == (Object)null) && !((Object)(object)((Component)ai).gameObject == (Object)null) && TryGetProfile(((Component)ai).gameObject, out var profile)) { ApplyDamageResistanceProfile(ai, profile); } } public static void UpdateCombatBehavior(MonsterAI monsterAI, float dt) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)monsterAI == (Object)null || (Object)(object)((Component)monsterAI).gameObject == (Object)null || !TryGetProfile(((Component)monsterAI).gameObject, out var profile) || !BehaviorByProfile.TryGetValue(profile, out var value)) { return; } Character character = ((BaseAI)monsterAI).m_character; Character targetCreature = ((BaseAI)monsterAI).GetTargetCreature(); if ((Object)(object)character == (Object)null || (Object)(object)targetCreature == (Object)null || CallBool(character, "IsDead") || CallBool(targetCreature, "IsDead")) { return; } BehaviorState state = GetState(monsterAI); RememberBaseState(monsterAI, character, state); float healthPercentage = GetHealthPercentage(character); Vector3 position = ((Component)targetCreature).transform.position; float num = Vector3.Distance(((Component)character).transform.position, position); ApplyFrenzyAndBossPhase(monsterAI, character, value, state, healthPercentage); if (!IsHumanoidBusy(character) && !ApplyReactiveDodgeMotion(monsterAI, position, dt, state)) { if (value.Has(CombatBehavior.LowHealthFear) && healthPercentage <= value.FearHealthThreshold) { ApplyFear(monsterAI, character, position, dt, state); } else if (value.Has(CombatBehavior.KiteWhenCrowded) && num <= value.KiteStartDistance) { ApplyKite(monsterAI, character, position, dt, value, state); } else if (value.Has(CombatBehavior.DuelistFootwork)) { ApplyDuelistFootwork(monsterAI, character, position, num, dt, value, state); } } } public static void ReactToPlayerAttack(Character attacker, Attack attack) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)attacker == (Object)null || attack == null || !IsPlayerAttacker(attacker) || attack.m_bowDraw) { return; } Vector3 position = ((Component)attacker).transform.position; MonsterAI[] array = Resources.FindObjectsOfTypeAll(); foreach (MonsterAI val in array) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null || !((Component)val).gameObject.activeInHierarchy || !TryGetProfile(((Component)val).gameObject, out var profile) || !BehaviorByProfile.TryGetValue(profile, out var value) || !value.Has(CombatBehavior.ReactiveDodge)) { continue; } Character character = ((BaseAI)val).m_character; if ((Object)(object)character == (Object)null || CallBool(character, "IsDead") || IsHumanoidBusy(character)) { continue; } BehaviorState state = GetState(val); if (Time.time < state.NextDodgeTime) { continue; } Vector3 position2 = ((Component)character).transform.position; float num = Vector3.Distance(position2, position); if (num > value.DodgeRange || !IsInAttackCone(attacker, position2) || Random.value > value.DodgeChance) { continue; } Vector3 val2 = position2 - position; val2.y = 0f; if (!(((Vector3)(ref val2)).sqrMagnitude < 0.01f)) { Vector3 val3 = Vector3.Cross(Vector3.up, ((Vector3)(ref val2)).normalized); if (Random.value < 0.5f) { val3 = -val3; } Vector3 val4 = val3 * 0.75f + ((Vector3)(ref val2)).normalized * 0.35f; Vector3 normalized = ((Vector3)(ref val4)).normalized; state.DodgePoint = position2 + normalized * value.DodgeStepDistance; state.DodgeLookAt = position; state.DodgeMoveUntil = Time.time + value.DodgeDuration; state.NextDodgeTime = Time.time + value.DodgeCooldown; } } } private static bool TryGetProfile(GameObject go, out StarwarsMobAIProfile profile) { string key = StarwarsMobMarkers.CleanName(((Object)go).name); return ProfilesByPrefabName.TryGetValue(key, out profile); } private static BehaviorState GetState(MonsterAI monsterAI) { int instanceID = ((Object)monsterAI).GetInstanceID(); if (!BehaviorStates.TryGetValue(instanceID, out BehaviorState value)) { value = new BehaviorState(); BehaviorStates[instanceID] = value; } return value; } private static void ApplyDamageResistanceProfile(BaseAI ai, StarwarsMobAIProfile profile) { //IL_0019: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) Character component = ((Component)ai).GetComponent(); if (!((Object)(object)component == (Object)null)) { DamageModifiers modifiers = component.m_damageModifiers; SetAllDamageModifiers(ref modifiers, (DamageModifier)0); switch (profile) { case StarwarsMobAIProfile.WookieeGuardian: modifiers.m_blunt = (DamageModifier)7; modifiers.m_frost = (DamageModifier)7; break; case StarwarsMobAIProfile.GamorreanBruiser: case StarwarsMobAIProfile.GamorreanCaptain: modifiers.m_blunt = (DamageModifier)7; modifiers.m_poison = (DamageModifier)7; break; case StarwarsMobAIProfile.WampaPredator: modifiers.m_blunt = (DamageModifier)7; modifiers.m_frost = (DamageModifier)1; modifiers.m_fire = (DamageModifier)2; break; case StarwarsMobAIProfile.SnowTrooper: modifiers.m_frost = (DamageModifier)7; break; case StarwarsMobAIProfile.SithBrute: case StarwarsMobAIProfile.SithJuggernaut: modifiers.m_blunt = (DamageModifier)7; modifiers.m_poison = (DamageModifier)7; break; case StarwarsMobAIProfile.RefugeeSkirmisher: case StarwarsMobAIProfile.JawaScavenger: case StarwarsMobAIProfile.NeimoidianOfficer: modifiers.m_blunt = (DamageModifier)8; modifiers.m_slash = (DamageModifier)8; break; } component.m_damageModifiers = modifiers; } } private static void SetAllDamageModifiers(ref DamageModifiers modifiers, DamageModifier modifier) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) modifiers.m_blunt = modifier; modifiers.m_slash = modifier; modifiers.m_pierce = modifier; modifiers.m_chop = modifier; modifiers.m_pickaxe = modifier; modifiers.m_fire = modifier; modifiers.m_frost = modifier; modifiers.m_lightning = modifier; modifiers.m_poison = modifier; modifiers.m_spirit = modifier; } private static void ApplyFrenzyAndBossPhase(MonsterAI monsterAI, Character character, BehaviorSettings behavior, BehaviorState state, float healthPercentage) { bool flag = behavior.Has(CombatBehavior.BossPhase) && healthPercentage <= behavior.BossPhaseHealthThreshold; bool flag2 = behavior.Has(CombatBehavior.LowHealthFrenzy) && healthPercentage <= behavior.FrenzyHealthThreshold; if (!flag && !flag2) { RestoreBaseState(monsterAI, character, state); return; } float num = (flag ? behavior.BossSpeedMultiplier : behavior.FrenzySpeedMultiplier); if (flag2) { num = Math.Max(num, behavior.FrenzySpeedMultiplier); } character.m_runSpeed = state.BaseRunSpeed * num; character.m_walkSpeed = state.BaseWalkSpeed * num; float num2 = (flag2 ? 0.55f : 0.7f); monsterAI.m_minAttackInterval = Math.Max(0.35f, state.BaseMinAttackInterval * num2); } private static void ApplyFear(MonsterAI monsterAI, Character character, Vector3 targetPosition, float dt, BehaviorState state) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) RestoreSpeeds(character, state); RestoreCombatSettings(monsterAI, state); monsterAI.m_enableHuntPlayer = false; monsterAI.m_fleeIfNotAlerted = true; monsterAI.m_fleeIfLowHealth = Math.Max(monsterAI.m_fleeIfLowHealth, 0.8f); ((BaseAI)monsterAI).m_fleeRange = Math.Max(((BaseAI)monsterAI).m_fleeRange, 24f); ((BaseAI)monsterAI).m_fleeInterval = 1.2f; ((BaseAI)monsterAI).SetHuntPlayer(false); ((BaseAI)monsterAI).Flee(dt, targetPosition); } private static void ApplyKite(MonsterAI monsterAI, Character character, Vector3 targetPosition, float dt, BehaviorSettings behavior, BehaviorState state) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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) if (!(Time.time < state.NextKiteTime)) { Vector3 val = ((Component)character).transform.position - targetPosition; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { Vector3 val2 = ((Component)character).transform.position + ((Vector3)(ref val)).normalized * behavior.KiteStepDistance; ((BaseAI)monsterAI).LookAt(targetPosition); ((BaseAI)monsterAI).MoveAndAvoid(dt, val2, 1.2f, true); state.NextKiteTime = Time.time + behavior.KiteCooldown; } } } private static bool ApplyReactiveDodgeMotion(MonsterAI monsterAI, Vector3 targetPosition, float dt, BehaviorState state) { //IL_0017: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) if (Time.time > state.DodgeMoveUntil) { return false; } Vector3 val = ((state.DodgeLookAt == Vector3.zero) ? targetPosition : state.DodgeLookAt); ((BaseAI)monsterAI).LookAt(val); ((BaseAI)monsterAI).MoveAndAvoid(dt, state.DodgePoint, 0.7f, true); return true; } private static void ApplyDuelistFootwork(MonsterAI monsterAI, Character character, Vector3 targetPosition, float distance, float dt, BehaviorSettings behavior, BehaviorState state) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (distance < behavior.DuelMinDistance || distance > behavior.DuelMaxDistance) { return; } if (Time.time >= state.NextDuelistMoveTime) { Vector3 val = ((Component)character).transform.position - targetPosition; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return; } Vector3 val2 = Vector3.Cross(Vector3.up, ((Vector3)(ref val)).normalized); state.DuelistDirection *= -1f; Vector3 val3 = val2 * state.DuelistDirection + ((Vector3)(ref val)).normalized * 0.25f; state.DuelistMoveDirection = ((Vector3)(ref val3)).normalized; state.DuelistMoveUntil = Time.time + behavior.DuelStepDuration; state.NextDuelistMoveTime = Time.time + behavior.DuelStepCooldown; } if (!(Time.time > state.DuelistMoveUntil)) { ((BaseAI)monsterAI).LookAt(targetPosition); ((BaseAI)monsterAI).MoveTowards(state.DuelistMoveDirection, true); } } private static void RememberBaseState(MonsterAI monsterAI, Character character, BehaviorState state) { if (!state.HasBaseState) { state.BaseRunSpeed = character.m_runSpeed; state.BaseWalkSpeed = character.m_walkSpeed; state.BaseMinAttackInterval = monsterAI.m_minAttackInterval; state.BaseMaxChaseDistance = monsterAI.m_maxChaseDistance; state.BaseAlertRange = monsterAI.m_alertRange; state.BaseEnableHuntPlayer = monsterAI.m_enableHuntPlayer; state.BaseFleeIfNotAlerted = monsterAI.m_fleeIfNotAlerted; state.BaseFleeIfLowHealth = monsterAI.m_fleeIfLowHealth; state.BaseFleeRange = ((BaseAI)monsterAI).m_fleeRange; state.BaseFleeInterval = ((BaseAI)monsterAI).m_fleeInterval; state.HasBaseState = true; } } private static void RestoreBaseState(MonsterAI monsterAI, Character character, BehaviorState state) { RestoreSpeeds(character, state); RestoreCombatSettings(monsterAI, state); } private static void RestoreSpeeds(Character character, BehaviorState state) { if (state.HasBaseState) { character.m_runSpeed = state.BaseRunSpeed; character.m_walkSpeed = state.BaseWalkSpeed; } } private static void RestoreCombatSettings(MonsterAI monsterAI, BehaviorState state) { if (state.HasBaseState) { monsterAI.m_minAttackInterval = state.BaseMinAttackInterval; monsterAI.m_maxChaseDistance = state.BaseMaxChaseDistance; monsterAI.m_alertRange = state.BaseAlertRange; monsterAI.m_enableHuntPlayer = state.BaseEnableHuntPlayer; monsterAI.m_fleeIfNotAlerted = state.BaseFleeIfNotAlerted; monsterAI.m_fleeIfLowHealth = state.BaseFleeIfLowHealth; ((BaseAI)monsterAI).m_fleeRange = state.BaseFleeRange; ((BaseAI)monsterAI).m_fleeInterval = state.BaseFleeInterval; } } public static float GetOutgoingDamageMultiplier(Character attacker) { if ((Object)(object)attacker == (Object)null || (Object)(object)((Component)attacker).gameObject == (Object)null) { return 1f; } if (!TryGetProfile(((Component)attacker).gameObject, out var profile)) { return 1f; } if (!BehaviorByProfile.TryGetValue(profile, out var value)) { return 1f; } float healthPercentage = GetHealthPercentage(attacker); float val = 1f; if (value.Has(CombatBehavior.BossPhase) && healthPercentage <= value.BossPhaseHealthThreshold) { val = Math.Max(val, GetBossPhaseDamageMultiplier(profile)); } if (value.Has(CombatBehavior.LowHealthFrenzy) && healthPercentage <= value.FrenzyHealthThreshold) { val = Math.Max(val, GetFrenzyDamageMultiplier(profile)); } return Math.Min(val, 1.4f); } private static float GetBossPhaseDamageMultiplier(StarwarsMobAIProfile profile) { if (1 == 0) { } float result = profile switch { StarwarsMobAIProfile.JediMaster => 1.18f, StarwarsMobAIProfile.YodaDuelist => 1.18f, StarwarsMobAIProfile.SithLord => 1.2f, StarwarsMobAIProfile.SithJuggernaut => 1.2f, StarwarsMobAIProfile.SithAssassin => 1.12f, StarwarsMobAIProfile.WampaPredator => 1.12f, StarwarsMobAIProfile.GamorreanCaptain => 1.1f, StarwarsMobAIProfile.BountyHunter => 1.1f, StarwarsMobAIProfile.CadBane => 1.12f, StarwarsMobAIProfile.JediVeteran => 1.1f, StarwarsMobAIProfile.CaraDune => 1.1f, StarwarsMobAIProfile.RebelCommander => 1.08f, _ => 1.08f, }; if (1 == 0) { } return result; } private static float GetFrenzyDamageMultiplier(StarwarsMobAIProfile profile) { if (1 == 0) { } float result = profile switch { StarwarsMobAIProfile.SithLord => 1.35f, StarwarsMobAIProfile.SithJuggernaut => 1.35f, StarwarsMobAIProfile.SithAssassin => 1.28f, StarwarsMobAIProfile.WampaPredator => 1.3f, StarwarsMobAIProfile.GamorreanCaptain => 1.25f, StarwarsMobAIProfile.SithBrute => 1.25f, StarwarsMobAIProfile.GamorreanBruiser => 1.18f, StarwarsMobAIProfile.SithAcolyte => 1.18f, _ => 1.15f, }; if (1 == 0) { } return result; } private static float GetHealthPercentage(Character character) { try { return Mathf.Clamp01(character.GetHealth() / character.m_health); } catch { return 1f; } } private static bool IsHumanoidBusy(Character character) { Humanoid val = (Humanoid)(object)((character is Humanoid) ? character : null); if (val == null) { return false; } return CallBool(val, "InAttack") || CallBool(val, "InDodge") || CallBool(val, "IsKnockedBack") || CallBool(val, "IsStaggering") || CallBool(val, "InMinorAction"); } private static bool IsPlayerAttacker(Character character) { if ((Object)(object)character == (Object)null) { return false; } if (string.Equals(((object)character).GetType().Name, "Player", StringComparison.OrdinalIgnoreCase)) { return true; } return CallBool(character, "IsPlayer"); } private static bool IsInAttackCone(Character attacker, Vector3 targetPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Vector3 val = targetPosition - ((Component)attacker).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return true; } Vector3 forward = ((Component)attacker).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { return true; } float num = Vector3.Dot(((Vector3)(ref forward)).normalized, ((Vector3)(ref val)).normalized); return num >= 0.25f; } private static bool CallBool(object instance, string methodName) { try { MethodInfo methodInfo = AccessTools.Method(instance.GetType(), methodName, Type.EmptyTypes, (Type[])null); if (methodInfo == null || methodInfo.ReturnType != typeof(bool)) { return false; } return (bool)methodInfo.Invoke(instance, null); } catch { return false; } } } [HarmonyPatch(typeof(BaseAI), "Awake")] internal static class StarwarsMobBaseAIAwakePatch { private static void Postfix(BaseAI __instance) { StarwarsMobAIProfiles.Apply(__instance); } } [HarmonyPatch(typeof(MonsterAI), "Awake")] internal static class StarwarsMobMonsterAIAwakePatch { private static void Postfix(MonsterAI __instance) { StarwarsMobAIProfiles.Apply((BaseAI)(object)__instance); } } [HarmonyPatch(typeof(MonsterAI), "UpdateAI")] internal static class StarwarsMobMonsterAIUpdatePatch { private static void Postfix(MonsterAI __instance, float dt) { StarwarsMobAIProfiles.UpdateCombatBehavior(__instance, dt); } } [HarmonyPatch(typeof(Character), "Damage")] internal static class StarwarsMobCharacterDamagePatch { private static void Prefix(HitData hit) { if (hit != null) { Character attacker = hit.GetAttacker(); float outgoingDamageMultiplier = StarwarsMobAIProfiles.GetOutgoingDamageMultiplier(attacker); if (!(outgoingDamageMultiplier <= 1f)) { hit.ApplyModifier(outgoingDamageMultiplier); } } } } internal static class StarwarsMobMarkers { private const string StarwarsPrefabPrefix = "STA_"; public static string CleanName(string name) { return (name ?? string.Empty).Replace("(Clone)", string.Empty).Trim(); } public static bool IsSupportedMob(string name) { name = CleanName(name); return !string.IsNullOrWhiteSpace(name) && name.StartsWith("STA_", StringComparison.OrdinalIgnoreCase); } public static bool IsSupportedMob(GameObject go) { if (!Object.op_Implicit((Object)(object)go)) { return false; } if (IsSupportedMob(((Object)go).name)) { return true; } return HasStarwarsEnemyMarker(go); } private static bool HasStarwarsEnemyMarker(GameObject go) { if (!Object.op_Implicit((Object)(object)go)) { return false; } Transform[] componentsInChildren = go.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && IsStarwarsEnemyMarkerName(((Object)val).name)) { return true; } } return false; } private static bool IsStarwarsEnemyMarkerName(string markerName) { string text = NormalizeMarkerName(markerName); if (string.IsNullOrWhiteSpace(text)) { return false; } return text.StartsWith("sta", StringComparison.Ordinal) && text.Contains("mob") && (text.Contains("enemy") || text.Contains("enemi")); } private static string NormalizeMarkerName(string markerName) { if (string.IsNullOrWhiteSpace(markerName)) { return string.Empty; } char[] array = new char[markerName.Length]; int length = 0; foreach (char c in markerName) { if (char.IsLetterOrDigit(c)) { array[length++] = char.ToLowerInvariant(c); } } return new string(array, 0, length); } } internal static class StarwarsPlayerShaderState { [HarmonyPatch(typeof(FejdStartup), "Awake")] private static class FejdStartupPatch { private static void Postfix(FejdStartup __instance) { CachePlayerBodyMaterial(__instance); } } [HarmonyPatch(typeof(Humanoid), "Awake")] private static class HumanoidAwakePatch { private static void Postfix(Humanoid __instance) { try { if ((Object)(object)__instance == (Object)null || !StarwarsMobMarkers.IsSupportedMob(((Component)__instance).gameObject)) { return; } if (!_initialized) { TryCacheLocalPlayerBodyMaterial(); } if (!_initialized) { LogMissingMaterialOnce(); return; } VisEquipment component = ((Component)__instance).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.m_bodyModel)) { ApplyPlayerBodyMaterial((Renderer)(object)component.m_bodyModel); } } catch (Exception arg) { StarwarsMobsPlugin.StarwarsMobsLogger.LogError((object)$"Starwars player shader state failed: {arg}"); } } } private static Material _playerBodyMaterial; private static bool _initialized; private static bool _missingMaterialLogged; private static void CachePlayerBodyMaterial(FejdStartup startup) { try { if (!((Object)(object)startup == (Object)null) && Object.op_Implicit((Object)(object)startup.m_playerPrefab)) { VisEquipment component = startup.m_playerPrefab.GetComponent(); CachePlayerBodyMaterial(component); } } catch (Exception arg) { StarwarsMobsPlugin.StarwarsMobsLogger.LogError((object)$"Starwars player shader cache failed: {arg}"); } } private static void TryCacheLocalPlayerBodyMaterial() { try { if (!((Object)(object)Player.m_localPlayer == (Object)null)) { VisEquipment component = ((Component)Player.m_localPlayer).GetComponent(); CachePlayerBodyMaterial(component); } } catch (Exception ex) { StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)("Starwars local player shader cache skipped: " + ex.Message)); } } private static void CachePlayerBodyMaterial(VisEquipment visEquipment) { if (Object.op_Implicit((Object)(object)visEquipment) && Object.op_Implicit((Object)(object)visEquipment.m_bodyModel)) { Material material = ((Renderer)visEquipment.m_bodyModel).material; if (Object.op_Implicit((Object)(object)material)) { _playerBodyMaterial = material; _initialized = true; _missingMaterialLogged = false; StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)"Starwars player body material cached for mob shader state."); } } } private static void ApplyPlayerBodyMaterial(Renderer bodyRenderer) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown Material[] sharedMaterials = bodyRenderer.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { return; } Material[] array = (Material[])(object)new Material[sharedMaterials.Length]; for (int i = 0; i < sharedMaterials.Length; i++) { Material val = sharedMaterials[i]; Material val2 = new Material(_playerBodyMaterial); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.mainTexture)) { val2.mainTexture = val.mainTexture; } array[i] = val2; } bodyRenderer.sharedMaterials = array; bodyRenderer.materials = array; } private static void LogMissingMaterialOnce() { if (!_missingMaterialLogged) { _missingMaterialLogged = true; StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)"Starwars player body material not ready; mob shader skipped."); } } } internal class StarwarsMobsItems { internal static void Register(StarwarsMobsPlugin plugin) { //IL_12c5: Unknown result type (might be due to invalid IL or missing references) //IL_12e1: Unknown result type (might be due to invalid IL or missing references) //IL_12fd: Unknown result type (might be due to invalid IL or missing references) //IL_1319: Unknown result type (might be due to invalid IL or missing references) //IL_1335: Unknown result type (might be due to invalid IL or missing references) //IL_1351: Unknown result type (might be due to invalid IL or missing references) //IL_136d: Unknown result type (might be due to invalid IL or missing references) //IL_1cd0: Unknown result type (might be due to invalid IL or missing references) //IL_1dad: Unknown result type (might be due to invalid IL or missing references) //IL_1e8a: Unknown result type (might be due to invalid IL or missing references) //IL_1f67: Unknown result type (might be due to invalid IL or missing references) //IL_2044: Unknown result type (might be due to invalid IL or missing references) //IL_2121: Unknown result type (might be due to invalid IL or missing references) //IL_21fe: Unknown result type (might be due to invalid IL or missing references) //IL_22db: Unknown result type (might be due to invalid IL or missing references) //IL_23b8: Unknown result type (might be due to invalid IL or missing references) //IL_2495: Unknown result type (might be due to invalid IL or missing references) //IL_2572: Unknown result type (might be due to invalid IL or missing references) //IL_264f: Unknown result type (might be due to invalid IL or missing references) //IL_272c: Unknown result type (might be due to invalid IL or missing references) //IL_2809: Unknown result type (might be due to invalid IL or missing references) //IL_28e6: Unknown result type (might be due to invalid IL or missing references) //IL_29c3: Unknown result type (might be due to invalid IL or missing references) //IL_2aa0: Unknown result type (might be due to invalid IL or missing references) //IL_2b7d: Unknown result type (might be due to invalid IL or missing references) //IL_2c5a: Unknown result type (might be due to invalid IL or missing references) //IL_2d37: Unknown result type (might be due to invalid IL or missing references) //IL_2e14: Unknown result type (might be due to invalid IL or missing references) //IL_2ef1: Unknown result type (might be due to invalid IL or missing references) //IL_2fce: Unknown result type (might be due to invalid IL or missing references) //IL_30ab: Unknown result type (might be due to invalid IL or missing references) //IL_3768: Unknown result type (might be due to invalid IL or missing references) //IL_3845: Unknown result type (might be due to invalid IL or missing references) //IL_3922: Unknown result type (might be due to invalid IL or missing references) //IL_39ff: Unknown result type (might be due to invalid IL or missing references) //IL_3adc: Unknown result type (might be due to invalid IL or missing references) //IL_3bb9: Unknown result type (might be due to invalid IL or missing references) //IL_3c96: Unknown result type (might be due to invalid IL or missing references) //IL_3d73: Unknown result type (might be due to invalid IL or missing references) //IL_3e50: Unknown result type (might be due to invalid IL or missing references) //IL_3f2d: Unknown result type (might be due to invalid IL or missing references) //IL_400a: Unknown result type (might be due to invalid IL or missing references) //IL_40e7: Unknown result type (might be due to invalid IL or missing references) //IL_41c4: Unknown result type (might be due to invalid IL or missing references) //IL_42a1: Unknown result type (might be due to invalid IL or missing references) //IL_437e: Unknown result type (might be due to invalid IL or missing references) //IL_445b: Unknown result type (might be due to invalid IL or missing references) Item item = new Item("starwarsmobs", "STA_TrophyWookie"); item.Name.English("Wookiee Trophy"); item.Name.Spanish("Trofeo de Wookiee"); item.Description.English("The severed head of a mighty Wookiee warrior."); item.Description.Spanish("La cabeza cortada de un poderoso guerrero Wookiee."); item.Snapshot(); SharedData val = item.Prefab.GetComponent()?.m_itemData?.m_shared; if (val != null) { val.m_weight = 2f; val.m_maxStackSize = 10; } Item item2 = new Item("starwarsmobs", "STA_TrophyDuros"); item2.Name.English("Duros Trophy"); item2.Name.Spanish("Trofeo de Duros"); item2.Description.English("The severed head of a Duros."); item2.Description.Spanish("La cabeza cortada de un Duros."); item2.Snapshot(); SharedData val2 = item2.Prefab.GetComponent()?.m_itemData?.m_shared; if (val2 != null) { val2.m_weight = 2f; val2.m_maxStackSize = 10; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item2.Prefab); Item item3 = new Item("starwarsmobs", "STA_TrophyTwilekFemale"); item3.Name.English("Female Twi'lek Trophy"); item3.Name.Spanish("Trofeo de Twi'lek femenina"); item3.Description.English("The severed head of a female Twi'lek."); item3.Description.Spanish("La cabeza cortada de una Twi'lek."); item3.Snapshot(); SharedData val3 = item3.Prefab.GetComponent()?.m_itemData?.m_shared; if (val3 != null) { val3.m_weight = 2f; val3.m_maxStackSize = 10; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item3.Prefab); Item item4 = new Item("starwarsmobs", "STA_TrophyTwilekMale"); item4.Name.English("Male Twi'lek Trophy"); item4.Name.Spanish("Trofeo de Twi'lek masculino"); item4.Description.English("The severed head of a male Twi'lek."); item4.Description.Spanish("La cabeza cortada de un Twi'lek."); item4.Snapshot(); SharedData val4 = item4.Prefab.GetComponent()?.m_itemData?.m_shared; if (val4 != null) { val4.m_weight = 2f; val4.m_maxStackSize = 10; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item4.Prefab); Item item5 = new Item("starwarsmobs", "STA_TrophyRODIAN"); item5.Name.English("Rodian Trophy"); item5.Name.Spanish("Trofeo de Rodiano"); item5.Description.English("The severed head of a Rodian."); item5.Description.Spanish("La cabeza cortada de un rodiano."); item5.Snapshot(); SharedData val5 = item5.Prefab.GetComponent()?.m_itemData?.m_shared; if (val5 != null) { val5.m_weight = 2f; val5.m_maxStackSize = 10; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item5.Prefab); Item item6 = new Item("starwarsmobs", "STA_TrophyDROIDBATLE"); item6.Name.English("Battle Droid Trophy"); item6.Name.Spanish("Trofeo de droide de batalla"); item6.Description.English("The salvaged head of a battle droid."); item6.Description.Spanish("La cabeza recuperada de un droide de batalla."); item6.Snapshot(); SharedData val6 = item6.Prefab.GetComponent()?.m_itemData?.m_shared; if (val6 != null) { val6.m_weight = 2f; val6.m_maxStackSize = 10; } MaterialReplacer.RegisterStarwarsCharacterMaterialFix(item6.Prefab); Item item7 = new Item("starwarsmobs", "STA_TrophyDROIDBATLE1"); item7.Name.English("Yellow Battle Droid Trophy"); item7.Name.Spanish("Trofeo de droide de batalla amarillo"); item7.Description.English("The salvaged head of a yellow battle droid."); item7.Description.Spanish("La cabeza recuperada de un droide de batalla amarillo."); item7.Snapshot(); SharedData val7 = item7.Prefab.GetComponent()?.m_itemData?.m_shared; if (val7 != null) { val7.m_weight = 2f; val7.m_maxStackSize = 10; } MaterialReplacer.RegisterStarwarsCharacterMaterialFix(item7.Prefab); Item item8 = new Item("starwarsmobs", "STA_TrophyTusken"); item8.Name.English("Tusken Trophy"); item8.Name.Spanish("Trofeo Tusken"); item8.Description.English("The severed head of a Tusken Raider."); item8.Description.Spanish("La cabeza cortada de un incursor Tusken."); item8.Snapshot(); SharedData val8 = item8.Prefab.GetComponent()?.m_itemData?.m_shared; if (val8 != null) { val8.m_weight = 2f; val8.m_maxStackSize = 10; } MaterialReplacer.RegisterFurCreatureForShaderSwap(item8.Prefab); Item item9 = new Item("starwarsmobs", "STA_TrophyJAWA"); item9.Name.English("Jawa Trophy"); item9.Name.Spanish("Trofeo Jawa"); item9.Description.English("The severed head of a Jawa scavenger."); item9.Description.Spanish("La cabeza cortada de un chatarrero Jawa."); item9.Snapshot(); SharedData val9 = item9.Prefab.GetComponent()?.m_itemData?.m_shared; if (val9 != null) { val9.m_weight = 2f; val9.m_maxStackSize = 10; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item9.Prefab); Item item10 = new Item("starwarsmobs", "STA_TrophyGAMORREAN"); item10.Name.English("Gamorrean Warrior Trophy"); item10.Name.Spanish("Trofeo de Gamorreano"); item10.Description.English("The severed head of a fierce Gamorrean warrior."); item10.Description.Spanish("La cabeza cortada de un feroz gamorreano."); item10.Snapshot(); SharedData val10 = item10.Prefab.GetComponent()?.m_itemData?.m_shared; if (val10 != null) { val10.m_weight = 2f; val10.m_maxStackSize = 10; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item10.Prefab); Item item11 = new Item("starwarsmobs", "STA_TrophyGAMORREANCAPITAN"); item11.Name.English("Gamorrean Warrior Trophy"); item11.Name.Spanish("Trofeo de Gerrero Gamorreano"); item11.Description.English("The severed head of a powerful Gamorrean Warrior."); item11.Description.Spanish("La cabeza cortada de un poderoso Guerrero gamorreano."); item11.Snapshot(); SharedData val11 = item11.Prefab.GetComponent()?.m_itemData?.m_shared; if (val11 != null) { val11.m_weight = 3f; val11.m_maxStackSize = 10; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item11.Prefab); Item item12 = new Item("starwarsmobs", "STA_TrophyNEUMONIANO"); item12.Name.English("Neimoidian Warrior Trophy"); item12.Name.Spanish("Trofeo de Guerrero Neimoidiano"); item12.Description.English("The severed head of a Neimoidian warrior."); item12.Description.Spanish("La cabeza cortada de un guerrero neimoidiano."); item12.Snapshot(); SharedData val12 = item12.Prefab.GetComponent()?.m_itemData?.m_shared; if (val12 != null) { val12.m_weight = 2f; val12.m_maxStackSize = 10; } MaterialReplacer.RegisterFurCreatureForShaderSwap(item12.Prefab); Item item13 = new Item("starwarsmobs", "STA_TrophyEWOOK"); item13.Name.English("Ewok Trophy"); item13.Name.Spanish("Trofeo Ewok"); item13.Description.English("The severed head of an Ewok."); item13.Description.Spanish("La cabeza cortada de un Ewok."); item13.Snapshot(); SharedData val13 = item13.Prefab.GetComponent()?.m_itemData?.m_shared; if (val13 != null) { val13.m_weight = 2f; val13.m_maxStackSize = 10; } MaterialReplacer.RegisterFurCreatureForShaderSwap(item13.Prefab); Item item14 = new Item("starwarsmobs", "STA_TrophyEWOOKCHIEF"); item14.Name.English("Ewok Chief Trophy"); item14.Name.Spanish("Trofeo de Jefe Ewok"); item14.Description.English("The severed head of an Ewok chief."); item14.Description.Spanish("La cabeza cortada de un jefe Ewok."); item14.Snapshot(); SharedData val14 = item14.Prefab.GetComponent()?.m_itemData?.m_shared; if (val14 != null) { val14.m_weight = 2f; val14.m_maxStackSize = 10; } MaterialReplacer.RegisterFurCreatureForShaderSwap(item14.Prefab); Item item15 = new Item("starwarsmobs", "STA_TrophyNEIMOIDIANVICEROY"); item15.Name.English("Neimoidian Viceroy Trophy"); item15.Name.Spanish("Trofeo de Virrey Neimoidiano"); item15.Description.English("The severed head of a Neimoidian viceroy."); item15.Description.Spanish("La cabeza cortada de un virrey neimoidiano."); item15.Snapshot(); SharedData val15 = item15.Prefab.GetComponent()?.m_itemData?.m_shared; if (val15 != null) { val15.m_weight = 3f; val15.m_maxStackSize = 10; } MaterialReplacer.RegisterFurCreatureForShaderSwap(item15.Prefab); Item item16 = new Item("starwarsmobs", "STA_TrophyYODA"); item16.Name.English("Yoda Trophy"); item16.Name.Spanish("Trofeo de Yoda"); item16.Description.English("The severed head of the legendary Jedi Master Yoda."); item16.Description.Spanish("La cabeza cortada del legendario Maestro Jedi Yoda."); item16.Snapshot(); SharedData val16 = item16.Prefab.GetComponent()?.m_itemData?.m_shared; if (val16 != null) { val16.m_weight = 2f; val16.m_maxStackSize = 10; } MaterialReplacer.RegisterGameObjectForShaderSwap(item16.Prefab, MaterialReplacer.ShaderType.UseUnityShader); Item item17 = new Item("starwarsmobs", "STA_TrophyWampa"); item17.Name.English("Wampa Trophy"); item17.Name.Spanish("Trofeo de Wampa"); item17.Description.English("The severed head of a ferocious Wampa."); item17.Description.Spanish("La cabeza cortada de un feroz Wampa."); item17.Snapshot(); SharedData val17 = item17.Prefab.GetComponent()?.m_itemData?.m_shared; if (val17 != null) { val17.m_weight = 4f; val17.m_maxStackSize = 10; } MaterialReplacer.RegisterFurCreatureForShaderSwap(item17.Prefab); Item item18 = new Item("starwarsmobs", "STA_TrophyADMIRALACKBAR"); item18.Name.English("Admiral Ackbar Trophy"); item18.Name.Spanish("Trofeo del Almirante Ackbar"); item18.Description.English("The severed head of Admiral Ackbar."); item18.Description.Spanish("La cabeza cortada del Almirante Ackbar."); item18.Snapshot(); SharedData val18 = item18.Prefab.GetComponent()?.m_itemData?.m_shared; if (val18 != null) { val18.m_weight = 2f; val18.m_maxStackSize = 10; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item18.Prefab); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "STA_Wookieedeath"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "STA_Wookieedeath1"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "STA_Wookieedeath2"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "STA_Wookieedeath3"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_wookie_alerth"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_wookie_death"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_wookie_idle"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_jawa_alerth"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_jawa_death"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_jawa_idle"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_tusken_alerth"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_tusken_death"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_tusken_idle"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_balltusken_hit1"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_mobsstarwarsrifle"); GameObject go = ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "vfx_Hitredblasternew"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_ewook_alerth"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_ewook_death"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_ewook_idle"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_WAMPA_alerth"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_WAMPA_death"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_WAMPA_howl"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_WAMPA_idle"); GameObject go2 = ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "vfx_HitamarilloSta"); GameObject go3 = ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "vfx_HitazulSta"); GameObject go4 = ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "vfx_HitblancoSta"); GameObject go5 = ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "vfx_HitmoradoSta"); GameObject go6 = ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "vfx_HitnaranjoSta"); GameObject go7 = ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "vfx_HitverdeSta"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_sabledeluz_hit"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_sabledeluz_swing"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_DROIDBATLE_alerth"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_DROIDBATLE_death"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_DROIDBATLE_idle"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "fx_Lava_explosion"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_SUPERDROIDBATLE_alerth1"); ItemManager.PrefabManager.RegisterPrefab(ItemManager.PrefabManager.RegisterAssetBundle("starwarsmobs"), "sfx_SUPERDROIDBATLE_idle1"); MaterialReplacer.RegisterEmissiveVfx(go2, new Color(1f, 0.78f, 0.08f)); MaterialReplacer.RegisterEmissiveVfx(go3, new Color(0.08f, 0.48f, 1f)); MaterialReplacer.RegisterEmissiveVfx(go4, new Color(0.92f, 0.96f, 1f)); MaterialReplacer.RegisterEmissiveVfx(go5, new Color(0.58f, 0.12f, 1f)); MaterialReplacer.RegisterEmissiveVfx(go6, new Color(1f, 0.34f, 0.04f)); MaterialReplacer.RegisterEmissiveVfx(go, new Color(1f, 0.04f, 0.015f)); MaterialReplacer.RegisterEmissiveVfx(go7, new Color(0.12f, 1f, 0.28f)); GameObject val19 = ItemManager.PrefabManager.RegisterPrefab("starwarsmobs", "Tuskenrifle_proyectile"); GameObject val20 = ItemManager.PrefabManager.RegisterPrefab("starwarsmobs", "BoltStarwars_projectilered"); GameObject val21 = ItemManager.PrefabManager.RegisterPrefab("starwarsmobs", "BoltStarwars_projectilered1"); GameObject val22 = ItemManager.PrefabManager.RegisterPrefab("starwarsmobs", "WAMPA_throw_projectile"); Item item19 = new Item("starwarsmobs", "TuskenRiffle"); item19.Configurable = Configurability.Stats; SharedData val23 = item19.Prefab.GetComponent()?.m_itemData?.m_shared; if (val23 != null) { val23.m_damages.m_slash = 35f; val23.m_damages.m_pierce = 25f; val23.m_damages.m_fire = 0f; val23.m_damages.m_frost = 0f; val23.m_damages.m_lightning = 0f; val23.m_damages.m_poison = 0f; val23.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item19.Prefab); Item item20 = new Item("starwarsmobs", "TuskenRiffleAttackPoke"); item20.Configurable = Configurability.Stats; SharedData val24 = item20.Prefab.GetComponent()?.m_itemData?.m_shared; if (val24 != null) { val24.m_damages.m_slash = 35f; val24.m_damages.m_pierce = 25f; val24.m_damages.m_fire = 0f; val24.m_damages.m_frost = 0f; val24.m_damages.m_lightning = 0f; val24.m_damages.m_poison = 0f; val24.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item20.Prefab); Item item21 = new Item("starwarsmobs", "TuskenGaffi_Stick"); item21.Configurable = Configurability.Stats; SharedData val25 = item21.Prefab.GetComponent()?.m_itemData?.m_shared; if (val25 != null) { val25.m_damages.m_blunt = 40f; val25.m_damages.m_pierce = 20f; val25.m_damages.m_fire = 0f; val25.m_damages.m_frost = 0f; val25.m_damages.m_lightning = 0f; val25.m_damages.m_poison = 0f; val25.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item21.Prefab); Item item22 = new Item("starwarsmobs", "JawaRifle"); item22.Configurable = Configurability.Stats; SharedData val26 = item22.Prefab.GetComponent()?.m_itemData?.m_shared; if (val26 != null) { val26.m_damages.m_slash = 28f; val26.m_damages.m_pierce = 18f; val26.m_damages.m_fire = 0f; val26.m_damages.m_frost = 0f; val26.m_damages.m_lightning = 0f; val26.m_damages.m_poison = 0f; val26.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item22.Prefab); Item item23 = new Item("starwarsmobs", "JawaRiflepoke"); item23.Configurable = Configurability.Stats; SharedData val27 = item23.Prefab.GetComponent()?.m_itemData?.m_shared; if (val27 != null) { val27.m_damages.m_slash = 28f; val27.m_damages.m_pierce = 18f; val27.m_damages.m_fire = 0f; val27.m_damages.m_frost = 0f; val27.m_damages.m_lightning = 0f; val27.m_damages.m_poison = 0f; val27.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item23.Prefab); Item item24 = new Item("starwarsmobs", "WOOKIERIFLE"); item24.Configurable = Configurability.Stats; SharedData val28 = item24.Prefab.GetComponent()?.m_itemData?.m_shared; if (val28 != null) { val28.m_damages.m_slash = 40f; val28.m_damages.m_pierce = 30f; val28.m_damages.m_fire = 0f; val28.m_damages.m_frost = 0f; val28.m_damages.m_lightning = 0f; val28.m_damages.m_poison = 0f; val28.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterArmoredHumanoidForShaderSwap(item24.Prefab); Item item25 = new Item("starwarsmobs", "WAMPA_attack_claw"); item25.Configurable = Configurability.Stats; SharedData val29 = item25.Prefab.GetComponent()?.m_itemData?.m_shared; if (val29 != null) { val29.m_damages.m_slash = 70f; val29.m_damages.m_blunt = 15f; val29.m_damages.m_fire = 0f; val29.m_damages.m_frost = 0f; val29.m_damages.m_lightning = 0f; val29.m_damages.m_poison = 0f; val29.m_damages.m_spirit = 0f; } Item item26 = new Item("starwarsmobs", "WAMPA_attack_clawdouble"); item26.Configurable = Configurability.Stats; SharedData val30 = item26.Prefab.GetComponent()?.m_itemData?.m_shared; if (val30 != null) { val30.m_damages.m_slash = 115f; val30.m_damages.m_blunt = 25f; val30.m_damages.m_fire = 0f; val30.m_damages.m_frost = 0f; val30.m_damages.m_lightning = 0f; val30.m_damages.m_poison = 0f; val30.m_damages.m_spirit = 0f; } Item item27 = new Item("starwarsmobs", "WAMPA_taunt"); item27.Configurable = Configurability.Stats; SharedData val31 = item27.Prefab.GetComponent()?.m_itemData?.m_shared; if (val31 != null) { val31.m_damages.m_blunt = 60f; val31.m_damages.m_fire = 0f; val31.m_damages.m_frost = 0f; val31.m_damages.m_lightning = 0f; val31.m_damages.m_poison = 0f; val31.m_damages.m_spirit = 0f; } Item item28 = new Item("starwarsmobs", "wampa_throw"); item28.Configurable = Configurability.Stats; SharedData val32 = item28.Prefab.GetComponent()?.m_itemData?.m_shared; if (val32 != null) { val32.m_damages.m_blunt = 95f; val32.m_damages.m_fire = 0f; val32.m_damages.m_frost = 45f; val32.m_damages.m_lightning = 0f; val32.m_damages.m_poison = 0f; val32.m_damages.m_spirit = 0f; } Item item29 = new Item("starwarsmobs", "Macewindusableattack"); item29.Configurable = Configurability.Stats; SharedData val33 = item29.Prefab.GetComponent()?.m_itemData?.m_shared; if (val33 != null) { val33.m_damages.m_slash = 115f; val33.m_damages.m_fire = 0f; val33.m_damages.m_frost = 0f; val33.m_damages.m_lightning = 0f; val33.m_damages.m_poison = 0f; val33.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item29.Prefab, new Color(0.56f, 0.12f, 1f)); Item item30 = new Item("starwarsmobs", "Macewindusableattack2hit"); item30.Configurable = Configurability.Stats; SharedData val34 = item30.Prefab.GetComponent()?.m_itemData?.m_shared; if (val34 != null) { val34.m_damages.m_slash = 115f; val34.m_damages.m_fire = 0f; val34.m_damages.m_frost = 0f; val34.m_damages.m_lightning = 0f; val34.m_damages.m_poison = 0f; val34.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item30.Prefab, new Color(0.56f, 0.12f, 1f)); Item item31 = new Item("starwarsmobs", "Macewindusableattack3hitarriba"); item31.Configurable = Configurability.Stats; SharedData val35 = item31.Prefab.GetComponent()?.m_itemData?.m_shared; if (val35 != null) { val35.m_damages.m_slash = 115f; val35.m_damages.m_fire = 0f; val35.m_damages.m_frost = 0f; val35.m_damages.m_lightning = 0f; val35.m_damages.m_poison = 0f; val35.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item31.Prefab, new Color(0.56f, 0.12f, 1f)); Item item32 = new Item("starwarsmobs", "Macewindusableattack3hitspin"); item32.Configurable = Configurability.Stats; SharedData val36 = item32.Prefab.GetComponent()?.m_itemData?.m_shared; if (val36 != null) { val36.m_damages.m_slash = 115f; val36.m_damages.m_fire = 0f; val36.m_damages.m_frost = 0f; val36.m_damages.m_lightning = 0f; val36.m_damages.m_poison = 0f; val36.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item32.Prefab, new Color(0.56f, 0.12f, 1f)); Item item33 = new Item("starwarsmobs", "MASTERKIADIMUNDIsableattack"); item33.Configurable = Configurability.Stats; SharedData val37 = item33.Prefab.GetComponent()?.m_itemData?.m_shared; if (val37 != null) { val37.m_damages.m_slash = 108f; val37.m_damages.m_fire = 0f; val37.m_damages.m_frost = 0f; val37.m_damages.m_lightning = 0f; val37.m_damages.m_poison = 0f; val37.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item33.Prefab, new Color(0.12f, 0.44f, 1f)); Item item34 = new Item("starwarsmobs", "MASTERKIADIMUNDIsableattack2hit"); item34.Configurable = Configurability.Stats; SharedData val38 = item34.Prefab.GetComponent()?.m_itemData?.m_shared; if (val38 != null) { val38.m_damages.m_slash = 108f; val38.m_damages.m_fire = 0f; val38.m_damages.m_frost = 0f; val38.m_damages.m_lightning = 0f; val38.m_damages.m_poison = 0f; val38.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item34.Prefab, new Color(0.12f, 0.44f, 1f)); Item item35 = new Item("starwarsmobs", "MASTERKIADIMUNDIsableattack3hitarriba"); item35.Configurable = Configurability.Stats; SharedData val39 = item35.Prefab.GetComponent()?.m_itemData?.m_shared; if (val39 != null) { val39.m_damages.m_slash = 108f; val39.m_damages.m_fire = 0f; val39.m_damages.m_frost = 0f; val39.m_damages.m_lightning = 0f; val39.m_damages.m_poison = 0f; val39.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item35.Prefab, new Color(0.12f, 0.44f, 1f)); Item item36 = new Item("starwarsmobs", "MASTERKIADIMUNDIsableattack3hitspin"); item36.Configurable = Configurability.Stats; SharedData val40 = item36.Prefab.GetComponent()?.m_itemData?.m_shared; if (val40 != null) { val40.m_damages.m_slash = 108f; val40.m_damages.m_fire = 0f; val40.m_damages.m_frost = 0f; val40.m_damages.m_lightning = 0f; val40.m_damages.m_poison = 0f; val40.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item36.Prefab, new Color(0.12f, 0.44f, 1f)); Item item37 = new Item("starwarsmobs", "MASTERPLOKONsableattack"); item37.Configurable = Configurability.Stats; SharedData val41 = item37.Prefab.GetComponent()?.m_itemData?.m_shared; if (val41 != null) { val41.m_damages.m_slash = 108f; val41.m_damages.m_fire = 0f; val41.m_damages.m_frost = 0f; val41.m_damages.m_lightning = 0f; val41.m_damages.m_poison = 0f; val41.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item37.Prefab, new Color(0.08f, 0.52f, 1f)); Item item38 = new Item("starwarsmobs", "MASTERPLOKONsableattack2hit"); item38.Configurable = Configurability.Stats; SharedData val42 = item38.Prefab.GetComponent()?.m_itemData?.m_shared; if (val42 != null) { val42.m_damages.m_slash = 108f; val42.m_damages.m_fire = 0f; val42.m_damages.m_frost = 0f; val42.m_damages.m_lightning = 0f; val42.m_damages.m_poison = 0f; val42.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item38.Prefab, new Color(0.08f, 0.52f, 1f)); Item item39 = new Item("starwarsmobs", "MASTERPLOKONsableattack3hitarriba"); item39.Configurable = Configurability.Stats; SharedData val43 = item39.Prefab.GetComponent()?.m_itemData?.m_shared; if (val43 != null) { val43.m_damages.m_slash = 108f; val43.m_damages.m_fire = 0f; val43.m_damages.m_frost = 0f; val43.m_damages.m_lightning = 0f; val43.m_damages.m_poison = 0f; val43.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item39.Prefab, new Color(0.08f, 0.52f, 1f)); Item item40 = new Item("starwarsmobs", "MASTERPLOKONsableattack3hitspin"); item40.Configurable = Configurability.Stats; SharedData val44 = item40.Prefab.GetComponent()?.m_itemData?.m_shared; if (val44 != null) { val44.m_damages.m_slash = 108f; val44.m_damages.m_fire = 0f; val44.m_damages.m_frost = 0f; val44.m_damages.m_lightning = 0f; val44.m_damages.m_poison = 0f; val44.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item40.Prefab, new Color(0.08f, 0.52f, 1f)); Item item41 = new Item("starwarsmobs", "MASTERKITFISTOsableattack"); item41.Configurable = Configurability.Stats; SharedData val45 = item41.Prefab.GetComponent()?.m_itemData?.m_shared; if (val45 != null) { val45.m_damages.m_slash = 110f; val45.m_damages.m_fire = 0f; val45.m_damages.m_frost = 0f; val45.m_damages.m_lightning = 0f; val45.m_damages.m_poison = 0f; val45.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item41.Prefab, new Color(0.08f, 1f, 0.32f)); Item item42 = new Item("starwarsmobs", "MASTERKITFISTOsableattack2hit"); item42.Configurable = Configurability.Stats; SharedData val46 = item42.Prefab.GetComponent()?.m_itemData?.m_shared; if (val46 != null) { val46.m_damages.m_slash = 110f; val46.m_damages.m_fire = 0f; val46.m_damages.m_frost = 0f; val46.m_damages.m_lightning = 0f; val46.m_damages.m_poison = 0f; val46.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item42.Prefab, new Color(0.08f, 1f, 0.32f)); Item item43 = new Item("starwarsmobs", "MASTERKITFISTOsableattack3hitarriba"); item43.Configurable = Configurability.Stats; SharedData val47 = item43.Prefab.GetComponent()?.m_itemData?.m_shared; if (val47 != null) { val47.m_damages.m_slash = 110f; val47.m_damages.m_fire = 0f; val47.m_damages.m_frost = 0f; val47.m_damages.m_lightning = 0f; val47.m_damages.m_poison = 0f; val47.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item43.Prefab, new Color(0.08f, 1f, 0.32f)); Item item44 = new Item("starwarsmobs", "MASTERKITFISTOsableattack3hitspin"); item44.Configurable = Configurability.Stats; SharedData val48 = item44.Prefab.GetComponent()?.m_itemData?.m_shared; if (val48 != null) { val48.m_damages.m_slash = 110f; val48.m_damages.m_fire = 0f; val48.m_damages.m_frost = 0f; val48.m_damages.m_lightning = 0f; val48.m_damages.m_poison = 0f; val48.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item44.Prefab, new Color(0.08f, 1f, 0.32f)); Item item45 = new Item("starwarsmobs", "MASTERYODAsableattack"); item45.Configurable = Configurability.Stats; SharedData val49 = item45.Prefab.GetComponent()?.m_itemData?.m_shared; if (val49 != null) { val49.m_damages.m_slash = 115f; val49.m_damages.m_fire = 0f; val49.m_damages.m_frost = 0f; val49.m_damages.m_lightning = 0f; val49.m_damages.m_poison = 0f; val49.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item45.Prefab, new Color(0.28f, 1f, 0.12f)); Item item46 = new Item("starwarsmobs", "MASTERYODAsableattack2hit"); item46.Configurable = Configurability.Stats; SharedData val50 = item46.Prefab.GetComponent()?.m_itemData?.m_shared; if (val50 != null) { val50.m_damages.m_slash = 115f; val50.m_damages.m_fire = 0f; val50.m_damages.m_frost = 0f; val50.m_damages.m_lightning = 0f; val50.m_damages.m_poison = 0f; val50.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item46.Prefab, new Color(0.28f, 1f, 0.12f)); Item item47 = new Item("starwarsmobs", "MASTERYODAsableattack3hitarriba"); item47.Configurable = Configurability.Stats; SharedData val51 = item47.Prefab.GetComponent()?.m_itemData?.m_shared; if (val51 != null) { val51.m_damages.m_slash = 115f; val51.m_damages.m_fire = 0f; val51.m_damages.m_frost = 0f; val51.m_damages.m_lightning = 0f; val51.m_damages.m_poison = 0f; val51.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item47.Prefab, new Color(0.28f, 1f, 0.12f)); Item item48 = new Item("starwarsmobs", "MASTERYODAsableattack3hitspin"); item48.Configurable = Configurability.Stats; SharedData val52 = item48.Prefab.GetComponent()?.m_itemData?.m_shared; if (val52 != null) { val52.m_damages.m_slash = 115f; val52.m_damages.m_fire = 0f; val52.m_damages.m_frost = 0f; val52.m_damages.m_lightning = 0f; val52.m_damages.m_poison = 0f; val52.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item48.Prefab, new Color(0.28f, 1f, 0.12f)); Item item49 = new Item("starwarsmobs", "MASTERQUIGONJINNsableattack"); item49.Configurable = Configurability.Stats; SharedData val53 = item49.Prefab.GetComponent()?.m_itemData?.m_shared; if (val53 != null) { val53.m_damages.m_slash = 108f; val53.m_damages.m_fire = 0f; val53.m_damages.m_frost = 0f; val53.m_damages.m_lightning = 0f; val53.m_damages.m_poison = 0f; val53.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item49.Prefab, new Color(0.28f, 1f, 0.12f)); Item item50 = new Item("starwarsmobs", "MASTERQUIGONJINNAsableattack2hit"); item50.Configurable = Configurability.Stats; SharedData val54 = item50.Prefab.GetComponent()?.m_itemData?.m_shared; if (val54 != null) { val54.m_damages.m_slash = 108f; val54.m_damages.m_fire = 0f; val54.m_damages.m_frost = 0f; val54.m_damages.m_lightning = 0f; val54.m_damages.m_poison = 0f; val54.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item50.Prefab, new Color(0.28f, 1f, 0.12f)); Item item51 = new Item("starwarsmobs", "MASTERQUIGONJINNsableattack3hitarriba"); item51.Configurable = Configurability.Stats; SharedData val55 = item51.Prefab.GetComponent()?.m_itemData?.m_shared; if (val55 != null) { val55.m_damages.m_slash = 108f; val55.m_damages.m_fire = 0f; val55.m_damages.m_frost = 0f; val55.m_damages.m_lightning = 0f; val55.m_damages.m_poison = 0f; val55.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item51.Prefab, new Color(0.28f, 1f, 0.12f)); Item item52 = new Item("starwarsmobs", "MASTERQUIGONJINNAsableattack3hitspin"); item52.Configurable = Configurability.Stats; SharedData val56 = item52.Prefab.GetComponent()?.m_itemData?.m_shared; if (val56 != null) { val56.m_damages.m_slash = 108f; val56.m_damages.m_fire = 0f; val56.m_damages.m_frost = 0f; val56.m_damages.m_lightning = 0f; val56.m_damages.m_poison = 0f; val56.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item52.Prefab, new Color(0.28f, 1f, 0.12f)); Item item53 = new Item("starwarsmobs", "DARTHTYRANUSsableattack"); item53.Configurable = Configurability.Stats; SharedData val57 = item53.Prefab.GetComponent()?.m_itemData?.m_shared; if (val57 != null) { val57.m_damages.m_slash = 120f; val57.m_damages.m_fire = 0f; val57.m_damages.m_frost = 0f; val57.m_damages.m_lightning = 0f; val57.m_damages.m_poison = 0f; val57.m_damages.m_spirit = 0f; } Item item54 = new Item("starwarsmobs", "DARTHTYRANUSsableattack2hit"); item54.Configurable = Configurability.Stats; SharedData val58 = item54.Prefab.GetComponent()?.m_itemData?.m_shared; if (val58 != null) { val58.m_damages.m_slash = 120f; val58.m_damages.m_fire = 0f; val58.m_damages.m_frost = 0f; val58.m_damages.m_lightning = 0f; val58.m_damages.m_poison = 0f; val58.m_damages.m_spirit = 0f; } Item item55 = new Item("starwarsmobs", "DARTHTYRANUSsableattack3hitarriba"); item55.Configurable = Configurability.Stats; SharedData val59 = item55.Prefab.GetComponent()?.m_itemData?.m_shared; if (val59 != null) { val59.m_damages.m_slash = 120f; val59.m_damages.m_fire = 0f; val59.m_damages.m_frost = 0f; val59.m_damages.m_lightning = 0f; val59.m_damages.m_poison = 0f; val59.m_damages.m_spirit = 0f; } Item item56 = new Item("starwarsmobs", "DARTHTYRANUSsableattack3hitspin"); item56.Configurable = Configurability.Stats; SharedData val60 = item56.Prefab.GetComponent()?.m_itemData?.m_shared; if (val60 != null) { val60.m_damages.m_slash = 120f; val60.m_damages.m_fire = 0f; val60.m_damages.m_frost = 0f; val60.m_damages.m_lightning = 0f; val60.m_damages.m_poison = 0f; val60.m_damages.m_spirit = 0f; } Item item57 = new Item("starwarsmobs", "AsajjVentresssableattack"); item57.Configurable = Configurability.Stats; SharedData val61 = item57.Prefab.GetComponent()?.m_itemData?.m_shared; if (val61 != null) { val61.m_damages.m_slash = 100f; val61.m_damages.m_fire = 0f; val61.m_damages.m_frost = 0f; val61.m_damages.m_lightning = 0f; val61.m_damages.m_poison = 0f; val61.m_damages.m_spirit = 0f; } Item item58 = new Item("starwarsmobs", "AsajjVentresssableattack2hit"); item58.Configurable = Configurability.Stats; SharedData val62 = item58.Prefab.GetComponent()?.m_itemData?.m_shared; if (val62 != null) { val62.m_damages.m_slash = 100f; val62.m_damages.m_fire = 0f; val62.m_damages.m_frost = 0f; val62.m_damages.m_lightning = 0f; val62.m_damages.m_poison = 0f; val62.m_damages.m_spirit = 0f; } Item item59 = new Item("starwarsmobs", "AsajjVentresssableattack3hitarriba"); item59.Configurable = Configurability.Stats; SharedData val63 = item59.Prefab.GetComponent()?.m_itemData?.m_shared; if (val63 != null) { val63.m_damages.m_slash = 100f; val63.m_damages.m_fire = 0f; val63.m_damages.m_frost = 0f; val63.m_damages.m_lightning = 0f; val63.m_damages.m_poison = 0f; val63.m_damages.m_spirit = 0f; } Item item60 = new Item("starwarsmobs", "AsajjVentresssableattack3hitspin"); item60.Configurable = Configurability.Stats; SharedData val64 = item60.Prefab.GetComponent()?.m_itemData?.m_shared; if (val64 != null) { val64.m_damages.m_slash = 100f; val64.m_damages.m_fire = 0f; val64.m_damages.m_frost = 0f; val64.m_damages.m_lightning = 0f; val64.m_damages.m_poison = 0f; val64.m_damages.m_spirit = 0f; } Item item61 = new Item("starwarsmobs", "DARTHSIONsableattack"); item61.Configurable = Configurability.Stats; SharedData val65 = item61.Prefab.GetComponent()?.m_itemData?.m_shared; if (val65 != null) { val65.m_damages.m_slash = 125f; val65.m_damages.m_fire = 0f; val65.m_damages.m_frost = 0f; val65.m_damages.m_lightning = 0f; val65.m_damages.m_poison = 0f; val65.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item61.Prefab, new Color(1f, 0.04f, 0.015f)); Item item62 = new Item("starwarsmobs", "DARTHSIONsableattack2hit"); item62.Configurable = Configurability.Stats; SharedData val66 = item62.Prefab.GetComponent()?.m_itemData?.m_shared; if (val66 != null) { val66.m_damages.m_slash = 125f; val66.m_damages.m_fire = 0f; val66.m_damages.m_frost = 0f; val66.m_damages.m_lightning = 0f; val66.m_damages.m_poison = 0f; val66.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item62.Prefab, new Color(1f, 0.04f, 0.015f)); Item item63 = new Item("starwarsmobs", "DARTHSIONsableattack3hitarriba"); item63.Configurable = Configurability.Stats; SharedData val67 = item63.Prefab.GetComponent()?.m_itemData?.m_shared; if (val67 != null) { val67.m_damages.m_slash = 125f; val67.m_damages.m_fire = 0f; val67.m_damages.m_frost = 0f; val67.m_damages.m_lightning = 0f; val67.m_damages.m_poison = 0f; val67.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item63.Prefab, new Color(1f, 0.04f, 0.015f)); Item item64 = new Item("starwarsmobs", "DARTHSIONsableattack3hitspin"); item64.Configurable = Configurability.Stats; SharedData val68 = item64.Prefab.GetComponent()?.m_itemData?.m_shared; if (val68 != null) { val68.m_damages.m_slash = 125f; val68.m_damages.m_fire = 0f; val68.m_damages.m_frost = 0f; val68.m_damages.m_lightning = 0f; val68.m_damages.m_poison = 0f; val68.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item64.Prefab, new Color(1f, 0.04f, 0.015f)); Item item65 = new Item("starwarsmobs", "JEDIBLUsableattack"); item65.Configurable = Configurability.Stats; SharedData val69 = item65.Prefab.GetComponent()?.m_itemData?.m_shared; if (val69 != null) { val69.m_damages.m_slash = 72f; val69.m_damages.m_fire = 0f; val69.m_damages.m_frost = 0f; val69.m_damages.m_lightning = 0f; val69.m_damages.m_poison = 0f; val69.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item65.Prefab, new Color(0.12f, 0.44f, 1f)); Item item66 = new Item("starwarsmobs", "JEDIBLUsableattack2hit"); item66.Configurable = Configurability.Stats; SharedData val70 = item66.Prefab.GetComponent()?.m_itemData?.m_shared; if (val70 != null) { val70.m_damages.m_slash = 72f; val70.m_damages.m_fire = 0f; val70.m_damages.m_frost = 0f; val70.m_damages.m_lightning = 0f; val70.m_damages.m_poison = 0f; val70.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item66.Prefab, new Color(0.12f, 0.44f, 1f)); Item item67 = new Item("starwarsmobs", "JEDIBLUsableattack3hitarriba"); item67.Configurable = Configurability.Stats; SharedData val71 = item67.Prefab.GetComponent()?.m_itemData?.m_shared; if (val71 != null) { val71.m_damages.m_slash = 72f; val71.m_damages.m_fire = 0f; val71.m_damages.m_frost = 0f; val71.m_damages.m_lightning = 0f; val71.m_damages.m_poison = 0f; val71.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item67.Prefab, new Color(0.12f, 0.44f, 1f)); Item item68 = new Item("starwarsmobs", "JEDIBLUsableattack3hitspin"); item68.Configurable = Configurability.Stats; SharedData val72 = item68.Prefab.GetComponent()?.m_itemData?.m_shared; if (val72 != null) { val72.m_damages.m_slash = 72f; val72.m_damages.m_fire = 0f; val72.m_damages.m_frost = 0f; val72.m_damages.m_lightning = 0f; val72.m_damages.m_poison = 0f; val72.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item68.Prefab, new Color(0.12f, 0.44f, 1f)); Item item69 = new Item("starwarsmobs", "JEDIGREENsableattack"); item69.Configurable = Configurability.Stats; SharedData val73 = item69.Prefab.GetComponent()?.m_itemData?.m_shared; if (val73 != null) { val73.m_damages.m_slash = 72f; val73.m_damages.m_fire = 0f; val73.m_damages.m_frost = 0f; val73.m_damages.m_lightning = 0f; val73.m_damages.m_poison = 0f; val73.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item69.Prefab, new Color(0.08f, 1f, 0.32f)); Item item70 = new Item("starwarsmobs", "JEDIGREENsableattack2hit"); item70.Configurable = Configurability.Stats; SharedData val74 = item70.Prefab.GetComponent()?.m_itemData?.m_shared; if (val74 != null) { val74.m_damages.m_slash = 72f; val74.m_damages.m_fire = 0f; val74.m_damages.m_frost = 0f; val74.m_damages.m_lightning = 0f; val74.m_damages.m_poison = 0f; val74.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item70.Prefab, new Color(0.08f, 1f, 0.32f)); Item item71 = new Item("starwarsmobs", "JEDIGREENsableattack3hitarriba"); item71.Configurable = Configurability.Stats; SharedData val75 = item71.Prefab.GetComponent()?.m_itemData?.m_shared; if (val75 != null) { val75.m_damages.m_slash = 72f; val75.m_damages.m_fire = 0f; val75.m_damages.m_frost = 0f; val75.m_damages.m_lightning = 0f; val75.m_damages.m_poison = 0f; val75.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item71.Prefab, new Color(0.08f, 1f, 0.32f)); Item item72 = new Item("starwarsmobs", "JEDIGREENsableattack3hitspin"); item72.Configurable = Configurability.Stats; SharedData val76 = item72.Prefab.GetComponent()?.m_itemData?.m_shared; if (val76 != null) { val76.m_damages.m_slash = 72f; val76.m_damages.m_fire = 0f; val76.m_damages.m_frost = 0f; val76.m_damages.m_lightning = 0f; val76.m_damages.m_poison = 0f; val76.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item72.Prefab, new Color(0.08f, 1f, 0.32f)); Item item73 = new Item("starwarsmobs", "PADAWANBLUsableattack"); item73.Configurable = Configurability.Stats; SharedData val77 = item73.Prefab.GetComponent()?.m_itemData?.m_shared; if (val77 != null) { val77.m_damages.m_slash = 52f; val77.m_damages.m_fire = 0f; val77.m_damages.m_frost = 0f; val77.m_damages.m_lightning = 0f; val77.m_damages.m_poison = 0f; val77.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item73.Prefab, new Color(0.12f, 0.44f, 1f)); Item item74 = new Item("starwarsmobs", "PADAWANBLUsableattack2hit"); item74.Configurable = Configurability.Stats; SharedData val78 = item74.Prefab.GetComponent()?.m_itemData?.m_shared; if (val78 != null) { val78.m_damages.m_slash = 52f; val78.m_damages.m_fire = 0f; val78.m_damages.m_frost = 0f; val78.m_damages.m_lightning = 0f; val78.m_damages.m_poison = 0f; val78.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item74.Prefab, new Color(0.12f, 0.44f, 1f)); Item item75 = new Item("starwarsmobs", "PADAWANBLUsableattack3hitarriba"); item75.Configurable = Configurability.Stats; SharedData val79 = item75.Prefab.GetComponent()?.m_itemData?.m_shared; if (val79 != null) { val79.m_damages.m_slash = 52f; val79.m_damages.m_fire = 0f; val79.m_damages.m_frost = 0f; val79.m_damages.m_lightning = 0f; val79.m_damages.m_poison = 0f; val79.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item75.Prefab, new Color(0.12f, 0.44f, 1f)); Item item76 = new Item("starwarsmobs", "PADAWANBLUsableattack3hitspin"); item76.Configurable = Configurability.Stats; SharedData val80 = item76.Prefab.GetComponent()?.m_itemData?.m_shared; if (val80 != null) { val80.m_damages.m_slash = 52f; val80.m_damages.m_fire = 0f; val80.m_damages.m_frost = 0f; val80.m_damages.m_lightning = 0f; val80.m_damages.m_poison = 0f; val80.m_damages.m_spirit = 0f; } MaterialReplacer.RegisterLightsaberBlade(item76.Prefab, new Color(0.12f, 0.44f, 1f)); Item item77 = new Item("starwarsmobs", "SITHACOLITYsableattack"); item77.Configurable = Configurability.Stats; SharedData val81 = item77.Prefab.GetComponent()?.m_itemData?.m_shared; if (val81 != null) { val81.m_damages.m_slash = 78f; val81.m_damages.m_fire = 0f; val81.m_damages.m_frost = 0f; val81.m_damages.m_lightning = 0f; val81.m_damages.m_poison = 0f; val81.m_damages.m_spirit = 0f; } Item item78 = new Item("starwarsmobs", "SITHACOLITYsableattack2hit"); item78.Configurable = Configurability.Stats; SharedData val82 = item78.Prefab.GetComponent()?.m_itemData?.m_shared; if (val82 != null) { val82.m_damages.m_slash = 78f; val82.m_damages.m_fire = 0f; val82.m_damages.m_frost = 0f; val82.m_damages.m_lightning = 0f; val82.m_damages.m_poison = 0f; val82.m_damages.m_spirit = 0f; } Item item79 = new Item("starwarsmobs", "SITHACOLITYsableattack3hitarriba"); item79.Configurable = Configurability.Stats; SharedData val83 = item79.Prefab.GetComponent()?.m_itemData?.m_shared; if (val83 != null) { val83.m_damages.m_slash = 78f; val83.m_damages.m_fire = 0f; val83.m_damages.m_frost = 0f; val83.m_damages.m_lightning = 0f; val83.m_damages.m_poison = 0f; val83.m_damages.m_spirit = 0f; } Item item80 = new Item("starwarsmobs", "SITHACOLITYsableattack3hitspin"); item80.Configurable = Configurability.Stats; SharedData val84 = item80.Prefab.GetComponent()?.m_itemData?.m_shared; if (val84 != null) { val84.m_damages.m_slash = 78f; val84.m_damages.m_fire = 0f; val84.m_damages.m_frost = 0f; val84.m_damages.m_lightning = 0f; val84.m_damages.m_poison = 0f; val84.m_damages.m_spirit = 0f; } Item item81 = new Item("starwarsmobs", "SUPERBATLEDROIDATTACK"); item81.Configurable = Configurability.Stats; SharedData val85 = item81.Prefab.GetComponent()?.m_itemData?.m_shared; if (val85 != null) { val85.m_damages.m_slash = 35f; val85.m_damages.m_pierce = 25f; val85.m_damages.m_fire = 0f; val85.m_damages.m_frost = 0f; val85.m_damages.m_lightning = 0f; val85.m_damages.m_poison = 0f; val85.m_damages.m_spirit = 0f; } Item item82 = new Item("starwarsmobs", "SUPERBATLEDROIDATTACK1"); item82.Configurable = Configurability.Stats; SharedData val86 = item82.Prefab.GetComponent()?.m_itemData?.m_shared; if (val86 != null) { val86.m_damages.m_slash = 35f; val86.m_damages.m_pierce = 25f; val86.m_damages.m_fire = 0f; val86.m_damages.m_frost = 0f; val86.m_damages.m_lightning = 0f; val86.m_damages.m_poison = 0f; val86.m_damages.m_spirit = 0f; val86.m_attack.m_projectileBursts = 2; val86.m_attack.m_burstInterval = 0f; } Item item83 = new Item("starwarsmobs", "SUPERBATLEDROIDATTACKSTRIKE"); item83.Configurable = Configurability.Stats; SharedData val87 = item83.Prefab.GetComponent()?.m_itemData?.m_shared; if (val87 != null) { val87.m_damages.m_slash = 35f; val87.m_damages.m_pierce = 25f; val87.m_damages.m_fire = 0f; val87.m_damages.m_frost = 0f; val87.m_damages.m_lightning = 0f; val87.m_damages.m_poison = 0f; val87.m_damages.m_spirit = 0f; } } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] public static class RegisterAndCheckVersion { private static void Prefix(ZNetPeer peer, ref ZNet __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)"Registering version RPC handler"); peer.m_rpc.Register("StarwarsMobs_VersionCheck", (Action)RpcHandlers.RPC_StarwarsMobs_Version); StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)"Invoking version check"); ZPackage val = new ZPackage(); val.Write("1.0.0"); peer.m_rpc.Invoke("StarwarsMobs_VersionCheck", new object[1] { val }); } } [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] public static class VerifyClient { private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance) { if (__instance.IsServer() && !RpcHandlers.ValidatedPeers.Contains(rpc)) { StarwarsMobsPlugin.StarwarsMobsLogger.LogDebug((object)("Peer (" + rpc.m_socket.GetHostName() + ") reached peer info before StarwarsMobs version validation completed.")); } return true; } private static void Postfix(ZNet __instance) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if (!((Object)(object)__instance == (Object)null) && !__instance.IsServer() && ZRoutedRpc.instance != null) { ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "RequestAdminSync", new object[1] { (object)new ZPackage() }); } } } [HarmonyPatch(typeof(FejdStartup), "ShowConnectError")] public class ShowConnectionError { private static void Postfix(FejdStartup __instance) { if (__instance.m_connectionFailedPanel.activeSelf) { __instance.m_connectionFailedError.fontSizeMax = 25f; __instance.m_connectionFailedError.fontSizeMin = 15f; TMP_Text connectionFailedError = __instance.m_connectionFailedError; connectionFailedError.text = connectionFailedError.text + "\n" + StarwarsMobsPlugin.ConnectionError; } } } [HarmonyPatch(typeof(ZNet), "Disconnect")] public static class RemoveDisconnectedPeerFromVerified { private static void Prefix(ZNetPeer peer, ref ZNet __instance) { if (__instance.IsServer()) { StarwarsMobsPlugin.StarwarsMobsLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list")); RpcHandlers.ValidatedPeers.Remove(peer.m_rpc); } } } public static class RpcHandlers { public static readonly List ValidatedPeers = new List(); public static void RPC_StarwarsMobs_Version(ZRpc rpc, ZPackage pkg) { string text = pkg.ReadString(); StarwarsMobsPlugin.StarwarsMobsLogger.LogInfo((object)("Version check, local: 1.0.0, remote: " + text)); if (text != "1.0.0") { StarwarsMobsPlugin.ConnectionError = "StarwarsMobs Installed: 1.0.0\n Needed: " + text; if (!((Object)(object)ZNet.instance == (Object)null) && ZNet.instance.IsServer()) { StarwarsMobsPlugin.StarwarsMobsLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting...")); rpc.Invoke("Error", new object[1] { 3 }); } } else if (!ZNet.instance.IsServer()) { StarwarsMobsPlugin.StarwarsMobsLogger.LogInfo((object)"Received same version from server!"); } else { StarwarsMobsPlugin.StarwarsMobsLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list")); ValidatedPeers.Add(rpc); } } } } namespace PieceManager { [PublicAPI] public static class MaterialReplacer { public enum ShaderType { PieceShader, VegetationShader, RockShader, RugShader, GrassShader, CustomCreature, UseUnityShader, ToonDeferred } private static readonly Dictionary ObjectToSwap; private static readonly Dictionary OriginalMaterials; private static readonly Dictionary ObjectsForShaderReplace; private static readonly HashSet ArmoredHumanoidShaderObjects; private static readonly HashSet FurCreatureShaderObjects; private static readonly HashSet SkeletonHammerShaderObjects; private static readonly HashSet DoubleSidedUseUnityShaderObjects; private static readonly HashSet StarwarsCharacterMaterialFixObjects; private static readonly HashSet WookieeRendererSplitFixObjects; private static readonly Dictionary BackfaceMeshCache; private static readonly HashSet BackfaceMeshWarnings; private static readonly Dictionary LightsaberBladeObjects; private static readonly Dictionary EmbeddedLightsaberBladeObjects; private static readonly Dictionary EmissiveVfxObjects; private static readonly HashSet CachedShaders; private static bool hasRun; static MaterialReplacer() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown ArmoredHumanoidShaderObjects = new HashSet(); FurCreatureShaderObjects = new HashSet(); SkeletonHammerShaderObjects = new HashSet(); DoubleSidedUseUnityShaderObjects = new HashSet(); StarwarsCharacterMaterialFixObjects = new HashSet(); WookieeRendererSplitFixObjects = new HashSet(); BackfaceMeshCache = new Dictionary(); BackfaceMeshWarnings = new HashSet(); LightsaberBladeObjects = new Dictionary(); EmbeddedLightsaberBladeObjects = new Dictionary(); EmissiveVfxObjects = new Dictionary(); CachedShaders = new HashSet(); hasRun = false; OriginalMaterials = new Dictionary(); ObjectToSwap = new Dictionary(); ObjectsForShaderReplace = new Dictionary(); Harmony val = new Harmony("org.bepinex.helpers.PieceManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZoneSystem), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MaterialReplacer), "ReplaceAllMaterialsWithOriginal", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void RegisterGameObjectForShaderSwap(GameObject go, ShaderType type) { if (!((Object)(object)go == (Object)null)) { if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, type); } else { ObjectsForShaderReplace[go] = type; } } } public static void RegisterArmoredHumanoidForShaderSwap(GameObject go) { if (!((Object)(object)go == (Object)null)) { FurCreatureShaderObjects.Remove(go); if (!ArmoredHumanoidShaderObjects.Contains(go)) { ArmoredHumanoidShaderObjects.Add(go); } if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, ShaderType.ToonDeferred); } else { ObjectsForShaderReplace[go] = ShaderType.ToonDeferred; } } } public static void RegisterFurCreatureForShaderSwap(GameObject go) { if (!((Object)(object)go == (Object)null)) { ArmoredHumanoidShaderObjects.Remove(go); if (!FurCreatureShaderObjects.Contains(go)) { FurCreatureShaderObjects.Add(go); } if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, ShaderType.CustomCreature); } else { ObjectsForShaderReplace[go] = ShaderType.CustomCreature; } } } public static void RegisterSkeletonHammerForShaderSwap(GameObject go) { if (!((Object)(object)go == (Object)null)) { ArmoredHumanoidShaderObjects.Remove(go); FurCreatureShaderObjects.Remove(go); if (!SkeletonHammerShaderObjects.Contains(go)) { SkeletonHammerShaderObjects.Add(go); } if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, ShaderType.CustomCreature); } else { ObjectsForShaderReplace[go] = ShaderType.CustomCreature; } } } public static void RegisterDoubleSidedUseUnityShader(GameObject go) { if (!((Object)(object)go == (Object)null)) { ArmoredHumanoidShaderObjects.Remove(go); FurCreatureShaderObjects.Remove(go); SkeletonHammerShaderObjects.Remove(go); StarwarsCharacterMaterialFixObjects.Remove(go); if (!DoubleSidedUseUnityShaderObjects.Contains(go)) { DoubleSidedUseUnityShaderObjects.Add(go); } if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, ShaderType.UseUnityShader); } else { ObjectsForShaderReplace[go] = ShaderType.UseUnityShader; } } } public static void RegisterWookieeFurFix(GameObject go) { if (!((Object)(object)go == (Object)null)) { ArmoredHumanoidShaderObjects.Remove(go); FurCreatureShaderObjects.Remove(go); SkeletonHammerShaderObjects.Remove(go); DoubleSidedUseUnityShaderObjects.Remove(go); StarwarsCharacterMaterialFixObjects.Remove(go); if (!WookieeRendererSplitFixObjects.Contains(go)) { WookieeRendererSplitFixObjects.Add(go); } if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, ShaderType.UseUnityShader); } else { ObjectsForShaderReplace[go] = ShaderType.UseUnityShader; } } } public static void RegisterStarwarsCharacterMaterialFix(GameObject go) { if (!((Object)(object)go == (Object)null)) { ArmoredHumanoidShaderObjects.Remove(go); FurCreatureShaderObjects.Remove(go); SkeletonHammerShaderObjects.Remove(go); DoubleSidedUseUnityShaderObjects.Remove(go); if (!StarwarsCharacterMaterialFixObjects.Contains(go)) { StarwarsCharacterMaterialFixObjects.Add(go); } if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, ShaderType.CustomCreature); } else { ObjectsForShaderReplace[go] = ShaderType.CustomCreature; } } } public static void RegisterLightsaberBlade(GameObject go, Color bladeColor) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)go == (Object)null)) { ArmoredHumanoidShaderObjects.Remove(go); FurCreatureShaderObjects.Remove(go); SkeletonHammerShaderObjects.Remove(go); DoubleSidedUseUnityShaderObjects.Remove(go); StarwarsCharacterMaterialFixObjects.Remove(go); WookieeRendererSplitFixObjects.Remove(go); ObjectsForShaderReplace.Remove(go); LightsaberBladeObjects[go] = bladeColor; } } public static void RegisterEmbeddedLightsaberBlade(GameObject go, Color bladeColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)go == (Object)null)) { EmbeddedLightsaberBladeObjects[go] = bladeColor; } } public static void RegisterEmissiveVfx(GameObject go, Color vfxColor) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)go == (Object)null)) { ArmoredHumanoidShaderObjects.Remove(go); FurCreatureShaderObjects.Remove(go); SkeletonHammerShaderObjects.Remove(go); DoubleSidedUseUnityShaderObjects.Remove(go); StarwarsCharacterMaterialFixObjects.Remove(go); WookieeRendererSplitFixObjects.Remove(go); ObjectsForShaderReplace.Remove(go); EmissiveVfxObjects[go] = vfxColor; } } public static void RegisterGameObjectForMatSwap(GameObject go, bool isJotunnMock = false) { if (!((Object)(object)go == (Object)null) && !ObjectToSwap.ContainsKey(go)) { ObjectToSwap.Add(go, isJotunnMock); } } private static void GetAllMaterials() { Material[] array = Resources.FindObjectsOfTypeAll(); foreach (Material val in array) { OriginalMaterials[((Object)val).name] = val; } } [HarmonyPriority(700)] private static void ReplaceAllMaterialsWithOriginal() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) if ((int)SystemInfo.graphicsDeviceType == 4 || hasRun) { return; } if (OriginalMaterials.Count == 0) { GetAllMaterials(); } foreach (KeyValuePair item in ObjectToSwap) { GameObject key = item.Key; bool value = item.Value; ProcessGameObjectMaterials(key, value); } AssetBundle[] array = Resources.FindObjectsOfTypeAll(); AssetBundle[] array2 = array; foreach (AssetBundle val in array2) { IEnumerable enumerable3; try { IEnumerable enumerable2; if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val)) { IEnumerable enumerable = val.LoadAllAssets(); enumerable2 = enumerable; } else { enumerable2 = from shader in ((IEnumerable)val.GetAllAssetNames()).Select((Func)val.LoadAsset) where (Object)(object)shader != (Object)null select shader; } enumerable3 = enumerable2; } catch (Exception) { continue; } if (enumerable3 == null) { continue; } foreach (Shader item2 in enumerable3) { CachedShaders.Add(item2); } } foreach (KeyValuePair item3 in ObjectsForShaderReplace) { GameObject key2 = item3.Key; ShaderType value2 = item3.Value; ProcessGameObjectShaders(key2, value2); } foreach (KeyValuePair lightsaberBladeObject in LightsaberBladeObjects) { ProcessLightsaberBladeMaterials(lightsaberBladeObject.Key, lightsaberBladeObject.Value); } foreach (KeyValuePair embeddedLightsaberBladeObject in EmbeddedLightsaberBladeObjects) { ProcessLightsaberBladeMaterials(embeddedLightsaberBladeObject.Key, embeddedLightsaberBladeObject.Value, includeCylinderRenderers: true); } foreach (KeyValuePair emissiveVfxObject in EmissiveVfxObjects) { ProcessEmissiveVfxMaterials(emissiveVfxObject.Key, emissiveVfxObject.Value); } hasRun = true; } private static void ProcessGameObjectMaterials(GameObject go, bool isJotunnMock) { Renderer[] componentsInChildren = go.GetComponentsInChildren(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials.Select((Material material) => ((Object)(object)material == (Object)null) ? null : ReplaceMaterial(material, isJotunnMock)).ToArray(); val.sharedMaterials = sharedMaterials; } } private static Material ReplaceMaterial(Material originalMaterial, bool isJotunnMock) { if ((Object)(object)originalMaterial == (Object)null) { return null; } string text = (isJotunnMock ? "JVLmock_" : "_REPLACE_"); if (!((Object)originalMaterial).name.StartsWith(text, StringComparison.Ordinal)) { return originalMaterial; } string text2 = ((Object)originalMaterial).name.Replace(" (Instance)", "").Replace(text, ""); if (OriginalMaterials.TryGetValue(text2, out Material value)) { return value; } Debug.LogWarning((object)("No suitable material found to replace: " + text2)); return originalMaterial; } private static void ProcessGameObjectShaders(GameObject go, ShaderType shaderType) { if ((Object)(object)go == (Object)null) { return; } if (DoubleSidedUseUnityShaderObjects.Contains(go)) { ProcessDoubleSidedUseUnityShader(go); return; } if (StarwarsCharacterMaterialFixObjects.Contains(go)) { ProcessStarwarsCharacterMaterialShaders(go); return; } if (WookieeRendererSplitFixObjects.Contains(go)) { ProcessWookieeRendererSplitFix(go); return; } if (SkeletonHammerShaderObjects.Contains(go)) { ProcessSkeletonHammerShaders(go); return; } if (ArmoredHumanoidShaderObjects.Contains(go)) { ProcessArmoredHumanoidShaders(go); return; } if (FurCreatureShaderObjects.Contains(go)) { ProcessFurCreatureShaders(go); return; } Renderer[] componentsInChildren = go.GetComponentsInChildren(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials; foreach (Material val2 in sharedMaterials) { if ((Object)(object)val2 != (Object)null) { val2.shader = GetShaderForType(val2.shader, shaderType, ((Object)val2.shader).name); } } } } private static bool ShouldSkipRenderer(Renderer renderer) { if ((Object)(object)renderer == (Object)null) { return true; } string text = ((Object)renderer).name.ToLowerInvariant(); return text.Contains("eyepos") || text.Contains("collider") || text.Contains("hitbox") || text.Contains("ragdoll") || text.Contains("trigger") || text.Contains("starwarsbackface"); } private static void ProcessDoubleSidedUseUnityShader(GameObject go) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown if ((Object)(object)go == (Object)null) { return; } Renderer[] componentsInChildren = go.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (ShouldSkipRenderer(val)) { continue; } Material[] sharedMaterials = val.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null)) { Material val3 = new Material(val2) { name = ((Object)val2).name + "_StarwarsUnityDoubleSided" }; val3.shader = GetShaderForType(val3.shader, ShaderType.UseUnityShader, ((Object)val3.shader).name); ApplyDoubleSidedCreatureSettings(val3); PreserveTransparency(val3); sharedMaterials[j] = val3; flag = true; } } if (flag) { val.sharedMaterials = sharedMaterials; } } EnsureBackfaceRenderers(go); } private static void ProcessStarwarsCharacterMaterialShaders(GameObject go) { //IL_0073: 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) //IL_0092: Expected O, but got Unknown if ((Object)(object)go == (Object)null) { return; } Renderer[] componentsInChildren = go.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (ShouldSkipRenderer(val)) { continue; } Material[] sharedMaterials = val.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null)) { Material val3 = new Material(val2) { name = ((Object)val2).name + "_StarwarsCharacterCreature" }; ApplyStarwarsCharacterMaterial(val3); sharedMaterials[j] = val3; flag = true; } } if (flag) { val.sharedMaterials = sharedMaterials; } } EnsureBackfaceRenderers(go); } private static void ApplyStarwarsCharacterMaterial(Material material) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) Texture firstTextureOrDefault = GetFirstTextureOrDefault(material, "_MainTex", "_BaseMap", "_BaseColorMap"); Texture firstTextureOrDefault2 = GetFirstTextureOrDefault(material, "_BumpMap", "_NormalMap", "_NormalTex"); Color val = GetFirstColorOrDefault(material, Color.white, "_Color", "_BaseColor", "_MainColor"); float floatOrDefault = GetFloatOrDefault(material, "_Metallic", 0f); float floatOrDefault2 = GetFloatOrDefault(material, "_Glossiness", 0.32f); float floatOrDefault3 = GetFloatOrDefault(material, "_Smoothness", floatOrDefault2); float floatOrDefault4 = GetFloatOrDefault(material, "_Cutoff", 0.5f); material.shader = FindShaderWithName(material.shader, "Custom/Creature"); ApplyDoubleSidedCreatureSettings(material); if (LooksLikeUnityMissingShaderTint(val)) { val = Color.white; } SetTextureIfExists(material, "_MainTex", firstTextureOrDefault); SetTextureIfExists(material, "_BaseMap", firstTextureOrDefault); if ((Object)(object)firstTextureOrDefault2 != (Object)null) { SetTextureIfExists(material, "_BumpMap", firstTextureOrDefault2); SetTextureIfExists(material, "_NormalMap", firstTextureOrDefault2); SetTextureIfExists(material, "_NormalTex", firstTextureOrDefault2); material.EnableKeyword("_NORMALMAP"); } float floatOrDefault5 = GetFloatOrDefault(material, "_BumpScale", 1f); float value = Mathf.Clamp(floatOrDefault5, 0.15f, 0.35f); SetFloatIfExists(material, "_BumpScale", value); SetColorIfExists(material, "_Color", val); SetColorIfExists(material, "_BaseColor", val); SetColorIfExists(material, "_MainColor", val); SetFloatIfExists(material, "_Metallic", floatOrDefault); SetFloatIfExists(material, "_Glossiness", floatOrDefault2); SetFloatIfExists(material, "_Smoothness", floatOrDefault3); SetFloatIfExists(material, "_Cutoff", floatOrDefault4); } private static void PreserveTransparency(Material material) { if (!((Object)(object)material == (Object)null)) { float floatOrDefault = GetFloatOrDefault(material, "_Cutoff", 0.5f); SetFloatIfExists(material, "_Cutoff", floatOrDefault); if (material.HasProperty("_Mode")) { SetFloatIfExists(material, "_Mode", material.GetFloat("_Mode")); } if (material.HasProperty("_SrcBlend") && material.HasProperty("_DstBlend")) { SetFloatIfExists(material, "_SrcBlend", material.GetFloat("_SrcBlend")); SetFloatIfExists(material, "_DstBlend", material.GetFloat("_DstBlend")); } } } private static void EnsureBackfaceRenderers(GameObject go) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_0244: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return; } SkinnedMeshRenderer[] componentsInChildren = go.GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.sharedMesh == (Object)null) && !ShouldSkipRenderer((Renderer)(object)val) && !((Object)(object)((Component)val).transform.Find("StarwarsBackfaceRenderer") != (Object)null)) { Mesh backfaceMesh = GetBackfaceMesh(val.sharedMesh); if (!((Object)(object)backfaceMesh == (Object)null)) { GameObject val2 = new GameObject("StarwarsBackfaceRenderer"); val2.transform.SetParent(((Component)val).transform, false); SkinnedMeshRenderer val3 = val2.AddComponent(); val3.sharedMesh = backfaceMesh; ((Renderer)val3).sharedMaterials = CreateBackfaceSafeMaterials(((Renderer)val).sharedMaterials); val3.rootBone = val.rootBone; val3.bones = val.bones; ((Renderer)val3).localBounds = ((Renderer)val).localBounds; val3.updateWhenOffscreen = val.updateWhenOffscreen; val3.quality = val.quality; ((Renderer)val3).shadowCastingMode = ((Renderer)val).shadowCastingMode; ((Renderer)val3).receiveShadows = ((Renderer)val).receiveShadows; } } } MeshRenderer[] componentsInChildren2 = go.GetComponentsInChildren(true); foreach (MeshRenderer val4 in componentsInChildren2) { if ((Object)(object)val4 == (Object)null || ShouldSkipRenderer((Renderer)(object)val4) || (Object)(object)((Component)val4).transform.Find("StarwarsBackfaceRenderer") != (Object)null) { continue; } MeshFilter component = ((Component)val4).GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.sharedMesh == (Object)null)) { Mesh backfaceMesh2 = GetBackfaceMesh(component.sharedMesh); if (!((Object)(object)backfaceMesh2 == (Object)null)) { GameObject val5 = new GameObject("StarwarsBackfaceRenderer"); val5.transform.SetParent(((Component)val4).transform, false); MeshFilter val6 = val5.AddComponent(); val6.sharedMesh = backfaceMesh2; MeshRenderer val7 = val5.AddComponent(); ((Renderer)val7).sharedMaterials = CreateBackfaceSafeMaterials(((Renderer)val4).sharedMaterials); ((Renderer)val7).shadowCastingMode = ((Renderer)val4).shadowCastingMode; ((Renderer)val7).receiveShadows = ((Renderer)val4).receiveShadows; } } } } private static Material[] CreateBackfaceSafeMaterials(Material[] sourceMaterials) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown if (sourceMaterials == null) { return Array.Empty(); } Material[] array = (Material[])(object)new Material[sourceMaterials.Length]; for (int i = 0; i < sourceMaterials.Length; i++) { Material val = sourceMaterials[i]; if ((Object)(object)val == (Object)null) { array[i] = null; continue; } Material val2 = new Material(val) { name = ((Object)val).name + "_StarwarsBackfaceSafe" }; SetFloatIfExists(val2, "_BumpScale", 0f); if (val2.HasProperty("_BumpMap")) { val2.SetTexture("_BumpMap", (Texture)null); } if (val2.HasProperty("_NormalMap")) { val2.SetTexture("_NormalMap", (Texture)null); } if (val2.HasProperty("_NormalTex")) { val2.SetTexture("_NormalTex", (Texture)null); } val2.DisableKeyword("_NORMALMAP"); ApplyDoubleSidedCreatureSettings(val2); PreserveTransparency(val2); array[i] = val2; } return array; } private static Mesh GetBackfaceMesh(Mesh originalMesh) { if ((Object)(object)originalMesh == (Object)null) { return null; } if (BackfaceMeshCache.TryGetValue(originalMesh, out Mesh value)) { return value; } if (!originalMesh.isReadable) { if (BackfaceMeshWarnings.Add(originalMesh)) { Debug.LogWarning((object)("[Starwars Backface] La malla '" + ((Object)originalMesh).name + "' no tiene Read/Write Enabled. Se omitirá su copia de caras internas. Activa Read/Write Enabled en el FBX y reconstruye el AssetBundle.")); } return null; } Mesh val = null; try { val = Object.Instantiate(originalMesh); ((Object)val).name = ((Object)originalMesh).name + "_StarwarsBackface"; for (int i = 0; i < val.subMeshCount; i++) { int[] triangles = val.GetTriangles(i); for (int j = 0; j + 2 < triangles.Length; j += 3) { int num = triangles[j]; triangles[j] = triangles[j + 1]; triangles[j + 1] = num; } val.SetTriangles(triangles, i, false); } val.RecalculateBounds(); BackfaceMeshCache[originalMesh] = val; return val; } catch (Exception ex) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } if (BackfaceMeshWarnings.Add(originalMesh)) { Debug.LogWarning((object)("[Starwars Backface] No se pudo generar la malla interna para '" + ((Object)originalMesh).name + "': " + ex.Message)); } return null; } } private static void ProcessWookieeRendererSplitFix(GameObject go) { //IL_0073: 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) //IL_0092: Expected O, but got Unknown if ((Object)(object)go == (Object)null) { return; } Renderer[] componentsInChildren = go.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (ShouldSkipRenderer(val)) { continue; } Material[] sharedMaterials = val.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null)) { Material val3 = new Material(val2) { name = ((Object)val2).name + "_StarwarsWookieeSplit" }; if (IsWookieeHairRenderer(val)) { ApplyWookieeHairCutout(val3); } else { ApplyWookieeSolidOpaque(val3); } sharedMaterials[j] = val3; flag = true; } } if (flag) { val.sharedMaterials = sharedMaterials; } } EnsureWookieeSolidCoreRenderers(go); } private static void EnsureWookieeSolidCoreRenderers(GameObject go) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return; } SkinnedMeshRenderer[] componentsInChildren = go.GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.sharedMesh == (Object)null) && !ShouldSkipRenderer((Renderer)(object)val) && !IsWookieeHairRenderer((Renderer)(object)val) && !((Object)(object)((Component)val).transform.Find("StarwarsWookieeSolidCoreRenderer") != (Object)null)) { string text = ((Object)val).name.ToLowerInvariant(); if (text.Contains("head") || text.Contains("body") || text.Contains("cuerpo") || text.Contains("cabeza") || text.Contains("m_head")) { GameObject val2 = new GameObject("StarwarsWookieeSolidCoreRenderer"); val2.transform.SetParent(((Component)val).transform, false); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one * 0.992f; SkinnedMeshRenderer val3 = val2.AddComponent(); val3.sharedMesh = val.sharedMesh; val3.rootBone = val.rootBone; val3.bones = val.bones; ((Renderer)val3).localBounds = ((Renderer)val).localBounds; val3.updateWhenOffscreen = val.updateWhenOffscreen; val3.quality = val.quality; ((Renderer)val3).shadowCastingMode = ((Renderer)val).shadowCastingMode; ((Renderer)val3).receiveShadows = ((Renderer)val).receiveShadows; ((Renderer)val3).sharedMaterials = CreateWookieeSolidCoreMaterials(((Renderer)val).sharedMaterials); } } } } private static Material[] CreateWookieeSolidCoreMaterials(Material[] sourceMaterials) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (sourceMaterials == null) { return Array.Empty(); } Material[] array = (Material[])(object)new Material[sourceMaterials.Length]; for (int i = 0; i < sourceMaterials.Length; i++) { Material val = sourceMaterials[i]; if ((Object)(object)val == (Object)null) { array[i] = null; continue; } Material val2 = new Material(val) { name = ((Object)val).name + "_StarwarsWookieeSolidCore" }; ApplyWookieeSolidOpaque(val2); val2.renderQueue = 1990; array[i] = val2; } return array; } private static bool IsWookieeHairRenderer(Renderer renderer) { if ((Object)(object)renderer == (Object)null) { return false; } string text = ((Object)renderer).name.ToLowerInvariant(); return text.Contains("haircard") || text.Contains("haircards") || text.Contains("hair_card") || text.Contains("hair cards"); } private static void ApplyWookieeHairCutout(Material material) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)material == (Object)null) && !((Object)(object)material.shader == (Object)null)) { Texture firstTextureOrDefault = GetFirstTextureOrDefault(material, "_MainTex", "_BaseMap", "_BaseColorMap"); Texture firstTextureOrDefault2 = GetFirstTextureOrDefault(material, "_BumpMap", "_NormalMap", "_NormalTex"); Color firstColorOrDefault = GetFirstColorOrDefault(material, Color.white, "_Color", "_BaseColor", "_MainColor"); material.shader = GetShaderForType(material.shader, ShaderType.UseUnityShader, ((Object)material.shader).name); SetTextureIfExists(material, "_MainTex", firstTextureOrDefault); SetTextureIfExists(material, "_BaseMap", firstTextureOrDefault); if ((Object)(object)firstTextureOrDefault2 != (Object)null) { SetTextureIfExists(material, "_BumpMap", firstTextureOrDefault2); SetTextureIfExists(material, "_NormalMap", firstTextureOrDefault2); SetTextureIfExists(material, "_NormalTex", firstTextureOrDefault2); material.EnableKeyword("_NORMALMAP"); } firstColorOrDefault.a = 1f; SetColorIfExists(material, "_Color", firstColorOrDefault); SetColorIfExists(material, "_BaseColor", firstColorOrDefault); SetColorIfExists(material, "_MainColor", firstColorOrDefault); SetFloatIfExists(material, "_Mode", 1f); SetFloatIfExists(material, "_Surface", 0f); SetFloatIfExists(material, "_AlphaClip", 1f); SetFloatIfExists(material, "_Cutoff", Mathf.Clamp(GetFloatOrDefault(material, "_Cutoff", 0.5f), 0.35f, 0.6f)); SetFloatIfExists(material, "_SrcBlend", 1f); SetFloatIfExists(material, "_DstBlend", 0f); SetFloatIfExists(material, "_ZWrite", 1f); SetFloatIfExists(material, "_Cull", 0f); SetFloatIfExists(material, "_CullMode", 0f); material.SetOverrideTag("RenderType", "TransparentCutout"); material.EnableKeyword("_ALPHATEST_ON"); material.DisableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); material.doubleSidedGI = true; material.renderQueue = 2450; } } private static void ApplyWookieeSolidOpaque(Material material) { //IL_006f: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)material == (Object)null) && !((Object)(object)material.shader == (Object)null)) { Texture firstTextureOrDefault = GetFirstTextureOrDefault(material, "_MainTex", "_BaseMap", "_BaseColorMap"); Texture firstTextureOrDefault2 = GetFirstTextureOrDefault(material, "_BumpMap", "_NormalMap", "_NormalTex"); Color val = GetFirstColorOrDefault(material, Color.white, "_Color", "_BaseColor", "_MainColor"); float floatOrDefault = GetFloatOrDefault(material, "_Metallic", 0f); float floatOrDefault2 = GetFloatOrDefault(material, "_Glossiness", 0.25f); float floatOrDefault3 = GetFloatOrDefault(material, "_Smoothness", floatOrDefault2); material.shader = GetShaderForType(material.shader, ShaderType.UseUnityShader, ((Object)material.shader).name); if (LooksLikeUnityMissingShaderTint(val)) { val = Color.white; } val.a = 1f; SetTextureIfExists(material, "_MainTex", firstTextureOrDefault); SetTextureIfExists(material, "_BaseMap", firstTextureOrDefault); if ((Object)(object)firstTextureOrDefault2 != (Object)null) { SetTextureIfExists(material, "_BumpMap", firstTextureOrDefault2); SetTextureIfExists(material, "_NormalMap", firstTextureOrDefault2); SetTextureIfExists(material, "_NormalTex", firstTextureOrDefault2); material.EnableKeyword("_NORMALMAP"); } SetColorIfExists(material, "_Color", val); SetColorIfExists(material, "_BaseColor", val); SetColorIfExists(material, "_MainColor", val); SetFloatIfExists(material, "_Metallic", floatOrDefault); SetFloatIfExists(material, "_Glossiness", floatOrDefault2); SetFloatIfExists(material, "_Smoothness", floatOrDefault3); ForceMaterialOpaqueHard(material); SetFloatIfExists(material, "_Cull", 0f); SetFloatIfExists(material, "_CullMode", 0f); material.doubleSidedGI = true; } } private static void ForceMaterialOpaqueHard(Material material) { if (!((Object)(object)material == (Object)null)) { material.SetOverrideTag("RenderType", "Opaque"); SetFloatIfExists(material, "_Mode", 0f); SetFloatIfExists(material, "_Surface", 0f); SetFloatIfExists(material, "_Blend", 0f); SetFloatIfExists(material, "_Alpha", 1f); SetFloatIfExists(material, "_AlphaClip", 0f); SetFloatIfExists(material, "_AlphaToMask", 0f); SetFloatIfExists(material, "_Cutoff", 0f); SetFloatIfExists(material, "_SrcBlend", 1f); SetFloatIfExists(material, "_DstBlend", 0f); SetFloatIfExists(material, "_ZWrite", 1f); material.DisableKeyword("_ALPHATEST_ON"); material.DisableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); material.DisableKeyword("_SURFACE_TYPE_TRANSPARENT"); material.EnableKeyword("_SURFACE_TYPE_OPAQUE"); material.renderQueue = 2000; } } private static void ProcessArmoredHumanoidShaders(GameObject go) { Renderer[] componentsInChildren = go.GetComponentsInChildren(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if ((Object)(object)val == (Object)null) { continue; } string text = ((Object)val).name.ToLowerInvariant(); if (text.Contains("eyepos") || text.Contains("collider") || text.Contains("hitbox")) { continue; } Material[] sharedMaterials = val.sharedMaterials; foreach (Material val2 in sharedMaterials) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null)) { val2.shader = FindShaderWithName(val2.shader, "ToonDeferredShading2017"); } } } } private static void ProcessFurCreatureShaders(GameObject go) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown Renderer[] componentsInChildren = go.GetComponentsInChildren(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if ((Object)(object)val == (Object)null) { continue; } string text = ((Object)val).name.ToLowerInvariant(); if (text.Contains("eyepos") || text.Contains("collider") || text.Contains("hitbox")) { continue; } Material[] sharedMaterials = val.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null)) { Material val3 = new Material(val2) { name = ((Object)val2).name + "_GlitnirCreature" }; ApplyFurCreatureMaterial(val3); sharedMaterials[j] = val3; flag = true; } } if (flag) { val.sharedMaterials = sharedMaterials; } } } private static void ApplyFurCreatureMaterial(Material material) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) Texture firstTextureOrDefault = GetFirstTextureOrDefault(material, "_MainTex", "_BaseMap", "_BaseColorMap"); Texture firstTextureOrDefault2 = GetFirstTextureOrDefault(material, "_BumpMap", "_NormalMap", "_NormalTex"); Color val = GetFirstColorOrDefault(material, Color.white, "_Color", "_BaseColor", "_MainColor"); float floatOrDefault = GetFloatOrDefault(material, "_Metallic", 0f); float floatOrDefault2 = GetFloatOrDefault(material, "_Glossiness", 0.18f); float floatOrDefault3 = GetFloatOrDefault(material, "_Smoothness", floatOrDefault2); float floatOrDefault4 = GetFloatOrDefault(material, "_Cutoff", 0.5f); material.shader = FindShaderWithName(material.shader, "Custom/Creature"); ApplyDoubleSidedCreatureSettings(material); if (LooksLikeUnityMissingShaderTint(val)) { val = Color.white; } SetTextureIfExists(material, "_MainTex", firstTextureOrDefault); SetTextureIfExists(material, "_BaseMap", firstTextureOrDefault); if ((Object)(object)firstTextureOrDefault2 != (Object)null) { SetTextureIfExists(material, "_BumpMap", firstTextureOrDefault2); material.EnableKeyword("_NORMALMAP"); } SetColorIfExists(material, "_Color", val); SetColorIfExists(material, "_BaseColor", val); SetColorIfExists(material, "_MainColor", val); SetFloatIfExists(material, "_Metallic", floatOrDefault); SetFloatIfExists(material, "_Glossiness", floatOrDefault2); SetFloatIfExists(material, "_Smoothness", floatOrDefault3); SetFloatIfExists(material, "_Cutoff", floatOrDefault4); } private static void ProcessSkeletonHammerShaders(GameObject go) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown Renderer[] componentsInChildren = go.GetComponentsInChildren(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if ((Object)(object)val == (Object)null) { continue; } string text = ((Object)val).name.ToLowerInvariant(); if (text.Contains("eyepos") || text.Contains("collider") || text.Contains("hitbox")) { continue; } Material[] sharedMaterials = val.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null)) { Material val3 = new Material(val2) { name = ((Object)val2).name + "_GlitnirSkeleton" }; ApplySkeletonHammerMaterial(val, val3); sharedMaterials[j] = val3; flag = true; } } if (flag) { val.sharedMaterials = sharedMaterials; } } } private static void ApplySkeletonHammerMaterial(Renderer renderer, Material material) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) Texture textureOrDefault = GetTextureOrDefault(material, "_MainTex"); Texture textureOrDefault2 = GetTextureOrDefault(material, "_BumpMap"); Color colorOrDefault = GetColorOrDefault(material, "_Color", Color.white); float floatOrDefault = GetFloatOrDefault(material, "_Cutoff", 0.5f); string text = ((Object)material).name.Replace(" (Instance)", "").ToLowerInvariant(); string text2 = ((Object)renderer).name.ToLowerInvariant(); bool flag = text.Contains("armor") || text.Contains("hammer") || text.Contains("mace") || text.Contains("metal") || text.Contains("plate") || text.Contains("helm") || text2.Contains("weapon") || text2.Contains("hammer") || text2.Contains("mace"); material.shader = FindShaderWithName(material.shader, "Custom/Creature"); ApplyDoubleSidedCreatureSettings(material); if ((Object)(object)textureOrDefault != (Object)null && material.HasProperty("_MainTex")) { material.SetTexture("_MainTex", textureOrDefault); } if ((Object)(object)textureOrDefault2 != (Object)null && material.HasProperty("_BumpMap")) { material.SetTexture("_BumpMap", textureOrDefault2); material.EnableKeyword("_NORMALMAP"); } float num = (flag ? 0.82f : 0.95f); Color value = default(Color); ((Color)(ref value))..ctor(Mathf.Clamp01(colorOrDefault.r * num), Mathf.Clamp01(colorOrDefault.g * num), Mathf.Clamp01(colorOrDefault.b * num), colorOrDefault.a); SetColorIfExists(material, "_Color", value); SetColorIfExists(material, "_BaseColor", value); SetColorIfExists(material, "_MainColor", value); SetFloatIfExists(material, "_Metallic", flag ? 0.05f : 0f); SetFloatIfExists(material, "_Glossiness", flag ? 0.28f : 0.18f); SetFloatIfExists(material, "_Smoothness", flag ? 0.28f : 0.18f); SetFloatIfExists(material, "_Cutoff", floatOrDefault); } private static void ApplyDoubleSidedCreatureSettings(Material material) { if ((Object)(object)material == (Object)null) { return; } bool flag = false; string[] array = new string[4] { "_Cull", "_CullMode", "_CullModeForward", "_CullModeDeferred" }; string[] array2 = array; foreach (string text in array2) { if (material.HasProperty(text)) { material.SetFloat(text, 0f); flag = true; } } if (material.HasProperty("_DoubleSidedEnable")) { material.SetFloat("_DoubleSidedEnable", 1f); } if (material.HasProperty("_DoubleSidedNormalMode")) { material.SetFloat("_DoubleSidedNormalMode", 1f); } material.EnableKeyword("_DOUBLESIDED_ON"); material.doubleSidedGI = true; } private static void ProcessLightsaberBladeMaterials(GameObject go, Color bladeColor, bool includeCylinderRenderers = false) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return; } Renderer[] componentsInChildren = go.GetComponentsInChildren(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if ((Object)(object)val == (Object)null) { continue; } Material[] sharedMaterials = val.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!((Object)(object)val2 == (Object)null) && IsLightsaberBladeMaterial(val, val2, includeCylinderRenderers)) { Material val3 = new Material(val2) { name = ((Object)val2).name + "_StarwarsBlade" }; ApplyLightsaberBladeMaterial(val3, bladeColor); sharedMaterials[j] = val3; flag = true; } } if (flag) { val.sharedMaterials = sharedMaterials; AddLightsaberBladeLight(val, bladeColor); } } } private static bool IsLightsaberBladeMaterial(Renderer renderer, Material material, bool includeCylinderRenderers = false) { string text = ((Object)renderer).name.ToLowerInvariant(); string text2 = ((Object)material).name.Replace(" (Instance)", "").ToLowerInvariant(); return text.Contains("laser") || text.Contains("blade") || text.Contains("sable") || text2.Contains("laser") || text2.Contains("blade") || text2.Contains("sable") || (includeCylinderRenderers && (text.Contains("cylinder") || text2.Contains("cylinder"))); } private static void ApplyLightsaberBladeMaterial(Material material, Color bladeColor) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Unlit/Color") ?? Shader.Find("Particles/Standard Unlit"); if ((Object)(object)val != (Object)null) { material.shader = val; } Color value = Color.white * 1.6f + new Color(bladeColor.r, bladeColor.g, bladeColor.b, 1f) * 3.2f; Color value2 = Color.white * 1.1f + new Color(bladeColor.r, bladeColor.g, bladeColor.b, 1f) * 5.5f; value.a = 1f; value2.a = 1f; SetColorIfExists(material, "_Color", value); SetColorIfExists(material, "_MainColor", value); SetColorIfExists(material, "_BaseColor", value); SetColorIfExists(material, "_EmissionColor", value2); SetColorIfExists(material, "_SpecColor", Color.black); SetFloatIfExists(material, "_Metallic", 0f); SetFloatIfExists(material, "_Glossiness", 0f); SetFloatIfExists(material, "_Smoothness", 0f); SetFloatIfExists(material, "_BumpScale", 0f); if (material.HasProperty("_BumpMap")) { material.SetTexture("_BumpMap", (Texture)null); } material.EnableKeyword("_EMISSION"); material.DisableKeyword("_NORMALMAP"); material.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; material.renderQueue = -1; } private static void AddLightsaberBladeLight(Renderer renderer, Color bladeColor) { //IL_001f: 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) Transform val = ((Component)renderer).transform.Find("StarwarsBladeLight"); GameObject val2 = (GameObject)(Object.op_Implicit((Object)(object)val) ? ((object)((Component)val).gameObject) : ((object)new GameObject("StarwarsBladeLight"))); if (!Object.op_Implicit((Object)(object)val)) { val2.transform.SetParent(((Component)renderer).transform, false); } Light val3 = val2.GetComponent() ?? val2.AddComponent(); val3.type = (LightType)2; val3.color = bladeColor; val3.intensity = 1.25f; val3.range = 3.5f; val3.shadows = (LightShadows)0; } private static void ProcessEmissiveVfxMaterials(GameObject go, Color vfxColor) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return; } Color val = Color.white * 0.35f + new Color(vfxColor.r, vfxColor.g, vfxColor.b, 1f) * 1.65f; val.a = 1f; ParticleSystem[] componentsInChildren = go.GetComponentsInChildren(true); foreach (ParticleSystem val2 in componentsInChildren) { MainModule main = val2.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(val); } Renderer[] componentsInChildren2 = go.GetComponentsInChildren(true); Renderer[] array = componentsInChildren2; foreach (Renderer val3 in array) { if ((Object)(object)val3 == (Object)null) { continue; } Material[] sharedMaterials = val3.sharedMaterials; bool flag = false; for (int k = 0; k < sharedMaterials.Length; k++) { Material val4 = sharedMaterials[k]; if (!((Object)(object)val4 == (Object)null)) { Material val5 = new Material(val4) { name = ((Object)val4).name + "_StarwarsVfx" }; ApplyEmissiveVfxMaterial(val5, vfxColor); sharedMaterials[k] = val5; flag = true; } } if (flag) { val3.sharedMaterials = sharedMaterials; } } } private static void ApplyEmissiveVfxMaterial(Material material, Color vfxColor) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0077: 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) //IL_0082: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Unlit/Transparent") ?? Shader.Find("Unlit/Color"); if ((Object)(object)val != (Object)null) { material.shader = val; } Color value = Color.white * 0.45f + new Color(vfxColor.r, vfxColor.g, vfxColor.b, 1f) * 2.25f; Color value2 = Color.white * 0.25f + new Color(vfxColor.r, vfxColor.g, vfxColor.b, 1f) * 4.5f; value.a = 1f; value2.a = 1f; SetColorIfExists(material, "_Color", value); SetColorIfExists(material, "_TintColor", value); SetColorIfExists(material, "_MainColor", value); SetColorIfExists(material, "_BaseColor", value); SetColorIfExists(material, "_EmissionColor", value2); SetFloatIfExists(material, "_Metallic", 0f); SetFloatIfExists(material, "_Glossiness", 0f); SetFloatIfExists(material, "_Smoothness", 0f); SetFloatIfExists(material, "_BumpScale", 0f); material.EnableKeyword("_EMISSION"); material.DisableKeyword("_NORMALMAP"); material.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } private static Texture? GetFirstTextureOrDefault(Material material, params string[] names) { foreach (string name in names) { Texture textureOrDefault = GetTextureOrDefault(material, name); if ((Object)(object)textureOrDefault != (Object)null) { return textureOrDefault; } } return null; } private static Texture? GetTextureOrDefault(Material material, string name) { if ((Object)(object)material != (Object)null && material.HasProperty(name)) { return material.GetTexture(name); } return null; } private static Color GetFirstColorOrDefault(Material material, Color fallback, params string[] names) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) foreach (string text in names) { if ((Object)(object)material != (Object)null && material.HasProperty(text)) { return material.GetColor(text); } } return fallback; } private static Color GetColorOrDefault(Material material, string name, Color fallback) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)material != (Object)null && material.HasProperty(name)) { return material.GetColor(name); } return fallback; } private static bool LooksLikeUnityMissingShaderTint(Color color) { //IL_0001: 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_001b: 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) //IL_002e: Unknown result type (might be due to invalid IL or missing references) return color.r > 0.55f && color.b > 0.55f && color.g < 0.48f && Mathf.Abs(color.r - color.b) < 0.35f; } private static float GetFloatOrDefault(Material material, string name, float fallback) { if ((Object)(object)material != (Object)null && material.HasProperty(name)) { return material.GetFloat(name); } return fallback; } private static void SetFloatIfExists(Material material, string name, float value) { if ((Object)(object)material != (Object)null && material.HasProperty(name)) { material.SetFloat(name, value); } } private static void SetTextureIfExists(Material material, string name, Texture? value) { if ((Object)(object)material != (Object)null && (Object)(object)value != (Object)null && material.HasProperty(name)) { material.SetTexture(name, value); } } private static void SetColorIfExists(Material material, string name, Color value) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)material != (Object)null && material.HasProperty(name)) { material.SetColor(name, value); } } private static Shader GetShaderForType(Shader orig, ShaderType shaderType, string originalShaderName) { return (Shader)(shaderType switch { ShaderType.PieceShader => FindShaderWithName(orig, "Custom/Piece"), ShaderType.VegetationShader => FindShaderWithName(orig, "Custom/Vegetation"), ShaderType.RockShader => FindShaderWithName(orig, "Custom/StaticRock"), ShaderType.RugShader => FindShaderWithName(orig, "Custom/Rug"), ShaderType.GrassShader => FindShaderWithName(orig, "Custom/Grass"), ShaderType.CustomCreature => FindShaderWithName(orig, "Custom/Creature"), ShaderType.ToonDeferred => FindShaderWithName(orig, "ToonDeferredShading2017"), ShaderType.UseUnityShader => FindShaderWithName(orig, ((Object)(object)FindShaderWithName(orig, originalShaderName) != (Object)null) ? originalShaderName : "ToonDeferredShading2017"), _ => FindShaderWithName(orig, "Standard"), }); } public static Shader FindShaderWithName(Shader origShader, string name) { foreach (Shader cachedShader in CachedShaders) { if (((Object)cachedShader).name == name) { return cachedShader; } } return origShader; } } [PublicAPI] public enum CraftingTable { None, [InternalName("piece_workbench")] Workbench, [InternalName("piece_cauldron")] Cauldron, [InternalName("forge")] Forge, [InternalName("piece_artisanstation")] ArtisanTable, [InternalName("piece_stonecutter")] StoneCutter, [InternalName("piece_magetable")] MageTable, [InternalName("blackforge")] BlackForge, [InternalName("piece_preptable")] FoodPreparationTable, [InternalName("piece_MeadCauldron")] MeadKetill, Custom } public class InternalName : Attribute { public readonly string internalName; public InternalName(string internalName) { this.internalName = internalName; } } [PublicAPI] public class ExtensionList { public readonly List ExtensionStations = new List(); public void Set(CraftingTable table, int maxStationDistance = 5) { ExtensionStations.Add(new ExtensionConfig { Table = table, maxStationDistance = maxStationDistance }); } public void Set(string customTable, int maxStationDistance = 5) { ExtensionStations.Add(new ExtensionConfig { Table = CraftingTable.Custom, custom = customTable, maxStationDistance = maxStationDistance }); } } public struct ExtensionConfig { public CraftingTable Table; public float maxStationDistance; public string? custom; } [PublicAPI] public class CraftingStationList { public readonly List Stations = new List(); public void Set(CraftingTable table) { Stations.Add(new CraftingStationConfig { Table = table }); } public void Set(string customTable) { Stations.Add(new CraftingStationConfig { Table = CraftingTable.Custom, custom = customTable }); } } public struct CraftingStationConfig { public CraftingTable Table; public int level; public string? custom; } [PublicAPI] public enum BuildPieceCategory { Misc = 0, Crafting = 1, BuildingWorkbench = 2, BuildingStonecutter = 3, Furniture = 4, All = 100, Custom = 99 } [PublicAPI] public class RequiredResourcesList { public readonly List Requirements = new List(); public void Add(string item, int amount, bool recover) { Requirements.Add(new Requirement { itemName = item, amount = amount, recover = recover }); } } public struct Requirement { public string itemName; public int amount; public bool recover; } public struct SpecialProperties { [Description("Admins should be the only ones that can build this piece.")] public bool AdminOnly; [Description("Turns off generating a config for this build piece.")] public bool NoConfig; } [PublicAPI] public class BuildingPieceCategory { public BuildPieceCategory Category; public string custom = ""; public void Set(BuildPieceCategory category) { Category = category; } public void Set(string customCategory) { Category = BuildPieceCategory.Custom; custom = customCategory; } } [PublicAPI] public class PieceTool { public readonly HashSet Tools = new HashSet(); public void Add(string tool) { Tools.Add(tool); } } [PublicAPI] public class BuildPiece { internal class PieceConfig { public ConfigEntry craft = null; public ConfigEntry category = null; public ConfigEntry customCategory = null; public ConfigEntry tools = null; public ConfigEntry extensionTable = null; public ConfigEntry customExtentionTable = null; public ConfigEntry maxStationDistance = null; public ConfigEntry table = null; public ConfigEntry customTable = null; } private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] public string? Category; [UsedImplicitly] public Action? CustomDrawer; } private class SerializedRequirements { public readonly List Reqs; public SerializedRequirements(List reqs) { Reqs = reqs; } public SerializedRequirements(string reqs) { Reqs = reqs.Split(new char[1] { ',' }).Select(delegate(string r) { string[] array = r.Split(new char[1] { ':' }); int result; bool result2 = default(bool); return new Requirement { itemName = array[0], amount = ((array.Length <= 1 || !int.TryParse(array[1], out result)) ? 1 : result), recover = (array.Length <= 2 || !bool.TryParse(array[2], out result2) || result2) }; }).ToList(); } public override string ToString() { return string.Join(",", Reqs.Select((Requirement r) => $"{r.itemName}:{r.amount}:{r.recover}")); } public static ItemDrop? fetchByName(ObjectDB objectDB, string name) { GameObject itemPrefab = objectDB.GetItemPrefab(name); ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)(((!string.IsNullOrWhiteSpace(((Object)plugin).name)) ? ("[" + ((Object)plugin).name + "]") : "") + " The required item '" + name + "' does not exist.")); } return val; } public static Requirement[] toPieceReqs(SerializedRequirements craft) { Dictionary dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func)((Requirement r) => r.itemName), (Func)delegate(Requirement r) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ItemDrop val = ResItem(r); return (val == null) ? ((Requirement)null) : new Requirement { m_amount = r.amount, m_resItem = val, m_recover = r.recover }; }); return dictionary.Values.Where((Requirement v) => v != null).ToArray(); static ItemDrop? ResItem(Requirement r) { return fetchByName(ObjectDB.instance, r.itemName); } } } internal static readonly List registeredPieces = new List(); private static readonly Queue<(GameObject prefab, float lightIntensity, Quaternion? camRot)> _snapshotQueue = new Queue<(GameObject, float, Quaternion?)>(); private static readonly Dictionary pieceMap = new Dictionary(); internal static Dictionary pieceConfigs = new Dictionary(); internal List Conversions = new List(); internal List conversions = new List(); [Description("Disables generation of the configs for your pieces. This is global, this turns it off for all pieces in your mod.")] public static bool ConfigurationEnabled = true; public readonly GameObject Prefab; [Description("Specifies the resources needed to craft the piece.\nUse .Add to add resources with their internal ID and an amount.\nUse one .Add for each resource type the building piece should need.")] public readonly RequiredResourcesList RequiredItems = new RequiredResourcesList(); [Description("Sets the category for the building piece.")] public readonly BuildingPieceCategory Category = new BuildingPieceCategory(); [Description("Specifies the tool needed to build your piece.\nUse .Add to add a tool.")] public readonly PieceTool Tool = new PieceTool(); [Description("Specifies the crafting station needed to build your piece.\nUse .Add to add a crafting station, using the CraftingTable enum and a minimum level for the crafting station.")] public CraftingStationList Crafting = new CraftingStationList(); [Description("Makes this piece a station extension")] public ExtensionList Extension = new ExtensionList(); [Description("Change the extended/special properties of your build piece.")] public SpecialProperties SpecialProperties; [Description("Specifies a config entry which toggles whether a recipe is active.")] public ConfigEntryBase? RecipeIsActive = null; private LocalizeKey? _name; private LocalizeKey? _description; internal string[] activeTools = null; private static object? configManager; private static Localization? _english; internal static BaseUnityPlugin? _plugin = null; private static bool hasConfigSync = true; private static object? _configSync; public LocalizeKey Name { get { LocalizeKey name = _name; if (name != null) { return name; } Piece component = Prefab.GetComponent(); if (component.m_name.StartsWith("$")) { _name = new LocalizeKey(component.m_name); } else { string text = "$piece_" + ((Object)Prefab).name.Replace(" ", "_"); _name = new LocalizeKey(text).English(component.m_name); component.m_name = text; } return _name; } } public LocalizeKey Description { get { LocalizeKey description = _description; if (description != null) { return description; } Piece component = Prefab.GetComponent(); if (component.m_description.StartsWith("$")) { _description = new LocalizeKey(component.m_description); } else { string text = "$piece_" + ((Object)Prefab).name.Replace(" ", "_") + "_description"; _description = new LocalizeKey(text).English(component.m_description); component.m_description = text; } return _description; } } private static Localization english => _english ?? (_english = LocalizationCache.ForLanguage("English")); internal static BaseUnityPlugin plugin { get { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown if (_plugin != null) { return _plugin; } IEnumerable source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); return _plugin; } } private static object? configSync { get { if (_configSync != null || !hasConfigSync) { return _configSync; } Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync"); if ((object)type != null) { _configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " PieceManager"); type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString()); type.GetProperty("IsLocked").SetValue(_configSync, true); } else { hasConfigSync = false; } return _configSync; } } public BuildPiece(string assetBundleFileName, string prefabName, string folderName = "assets") : this(PiecePrefabManager.RegisterAssetBundle(assetBundleFileName, folderName), prefabName) { } public BuildPiece(AssetBundle bundle, string prefabName) { Prefab = PiecePrefabManager.RegisterPrefab(bundle, prefabName); registeredPieces.Add(this); } internal static void Patch_FejdStartup(FejdStartup __instance) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Expected O, but got Unknown //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Expected O, but got Unknown //IL_08ea: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Expected O, but got Unknown //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Expected O, but got Unknown //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Expected O, but got Unknown //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Expected O, but got Unknown //IL_0b7e: Unknown result type (might be due to invalid IL or missing references) //IL_0b88: Expected O, but got Unknown //IL_0c18: Unknown result type (might be due to invalid IL or missing references) //IL_0c22: Expected O, but got Unknown Type configManagerType = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager"); configManager = ((configManagerType == null) ? null : Chainloader.ManagerObject.GetComponent(configManagerType)); foreach (BuildPiece registeredPiece in registeredPieces) { registeredPiece.activeTools = registeredPiece.Tool.Tools.DefaultIfEmpty("Hammer").ToArray(); if (registeredPiece.Category.Category != BuildPieceCategory.Custom) { registeredPiece.Prefab.GetComponent().m_category = (PieceCategory)registeredPiece.Category.Category; } else { registeredPiece.Prefab.GetComponent().m_category = PiecePrefabManager.GetCategory(registeredPiece.Category.custom); } } if (!ConfigurationEnabled) { return; } bool saveOnConfigSet = plugin.Config.SaveOnConfigSet; plugin.Config.SaveOnConfigSet = false; foreach (BuildPiece registeredPiece2 in registeredPieces) { BuildPiece piece = registeredPiece2; if (piece.SpecialProperties.NoConfig) { continue; } PieceConfig pieceConfig = (pieceConfigs[piece] = new PieceConfig()); PieceConfig cfg = pieceConfig; Piece piecePrefab = piece.Prefab.GetComponent(); string pieceName = piecePrefab.m_name; string englishName = new Regex("[=\\n\\t\\\\\"\\'\\[\\]]*").Replace(english.Localize(pieceName), "").Trim(); string localizedName = Localization.instance.Localize(pieceName).Trim(); int order = 0; cfg.category = config(englishName, "Build Table Category", piece.Category.Category, new ConfigDescription("Build Category where " + localizedName + " is available.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Category = localizedName } })); ConfigurationManagerAttributes customTableAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), Browsable = (cfg.category.Value == BuildPieceCategory.Custom), Category = localizedName }; cfg.customCategory = config(englishName, "Custom Build Category", piece.Category.custom, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.category.SettingChanged += BuildTableConfigChanged; cfg.customCategory.SettingChanged += BuildTableConfigChanged; if (cfg.category.Value == BuildPieceCategory.Custom) { piecePrefab.m_category = PiecePrefabManager.GetCategory(cfg.customCategory.Value); } else { piecePrefab.m_category = (PieceCategory)cfg.category.Value; } cfg.tools = config(englishName, "Tools", string.Join(", ", piece.activeTools), new ConfigDescription("Comma separated list of tools where " + localizedName + " is available.", (AcceptableValueBase)null, new object[1] { customTableAttributes })); piece.activeTools = (from s in cfg.tools.Value.Split(new char[1] { ',' }) select s.Trim()).ToArray(); cfg.tools.SettingChanged += delegate { Inventory[] source = (from c in Player.s_players.Select((Player p) => ((Humanoid)p).GetInventory()).Concat(from c in Object.FindObjectsByType((FindObjectsSortMode)0) select c.GetInventory()) where c != null select c).ToArray(); Dictionary> dictionary = (from kv in (from i in (from p in ObjectDB.instance.m_items select p.GetComponent() into c where Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((Component)c).GetComponent()) select c).Concat(ItemDrop.s_instances) select new KeyValuePair(Utils.GetPrefabName(((Component)i).gameObject), i.m_itemData)).Concat(from i in source.SelectMany((Inventory i) => i.GetAllItems()) select new KeyValuePair(((Object)i.m_dropPrefab).name, i)) where Object.op_Implicit((Object)(object)kv.Value.m_shared.m_buildPieces) group kv by kv.Key).ToDictionary((IGrouping> g) => g.Key, (IGrouping> g) => g.Select((KeyValuePair kv) => kv.Value.m_shared.m_buildPieces).Distinct().ToList()); string[] array4 = piece.activeTools; foreach (string key in array4) { if (dictionary.TryGetValue(key, out var value)) { foreach (PieceTable item3 in value) { item3.m_pieces.Remove(piece.Prefab); } } } piece.activeTools = (from s in cfg.tools.Value.Split(new char[1] { ',' }) select s.Trim()).ToArray(); if (Object.op_Implicit((Object)(object)ObjectDB.instance)) { string[] array5 = piece.activeTools; foreach (string key2 in array5) { if (dictionary.TryGetValue(key2, out var value2)) { foreach (PieceTable item4 in value2) { if (!item4.m_pieces.Contains(piece.Prefab)) { item4.m_pieces.Add(piece.Prefab); } } } } if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Player.m_localPlayer.m_buildPieces)) { PiecePrefabManager.CategoryRefreshNeeded = true; ((Humanoid)Player.m_localPlayer).SetPlaceMode(Player.m_localPlayer.m_buildPieces); } } }; StationExtension pieceExtensionComp; List hideWhenNoneAttributes; if (piece.Extension.ExtensionStations.Count > 0) { pieceExtensionComp = piece.Prefab.GetOrAddComponent(); PieceConfig pieceConfig3 = cfg; string text = englishName; CraftingTable table = piece.Extension.ExtensionStations.First().Table; string text2 = "Crafting station that " + localizedName + " extends."; object[] array = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes(); int num = order - 1; order = num; configurationManagerAttributes.Order = num; array[0] = configurationManagerAttributes; pieceConfig3.extensionTable = config(text, "Extends Station", table, new ConfigDescription(text2, (AcceptableValueBase)null, array)); cfg.customExtentionTable = config(englishName, "Custom Extend Station", piece.Extension.ExtensionStations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); PieceConfig pieceConfig4 = cfg; string text3 = englishName; float maxStationDistance = piece.Extension.ExtensionStations.First().maxStationDistance; string text4 = "Distance from the station that " + localizedName + " can be placed."; object[] array2 = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes2.Order = num; array2[0] = configurationManagerAttributes2; pieceConfig4.maxStationDistance = config(text3, "Max Station Distance", maxStationDistance, new ConfigDescription(text4, (AcceptableValueBase)null, array2)); hideWhenNoneAttributes = new List(); cfg.extensionTable.SettingChanged += ExtensionTableConfigChanged; cfg.customExtentionTable.SettingChanged += ExtensionTableConfigChanged; cfg.maxStationDistance.SettingChanged += ExtensionTableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes3 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes3.Order = num; configurationManagerAttributes3.Browsable = cfg.extensionTable.Value != CraftingTable.None; ConfigurationManagerAttributes item = configurationManagerAttributes3; hideWhenNoneAttributes.Add(item); } List hideWhenNoneAttributes2; if (piece.Crafting.Stations.Count > 0) { hideWhenNoneAttributes2 = new List(); PieceConfig pieceConfig5 = cfg; string text5 = englishName; CraftingTable table2 = piece.Crafting.Stations.First().Table; string text6 = "Crafting station where " + localizedName + " is available."; object[] array3 = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes4 = new ConfigurationManagerAttributes(); int num = order - 1; order = num; configurationManagerAttributes4.Order = num; array3[0] = configurationManagerAttributes4; pieceConfig5.table = config(text5, "Crafting Station", table2, new ConfigDescription(text6, (AcceptableValueBase)null, array3)); cfg.customTable = config(englishName, "Custom Crafting Station", piece.Crafting.Stations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.table.SettingChanged += TableConfigChanged; cfg.customTable.SettingChanged += TableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes5 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes5.Order = num; configurationManagerAttributes5.Browsable = cfg.table.Value != CraftingTable.None; ConfigurationManagerAttributes item2 = configurationManagerAttributes5; hideWhenNoneAttributes2.Add(item2); } cfg.craft = itemConfig("Crafting Costs", new SerializedRequirements(piece.RequiredItems.Requirements).ToString(), "Item costs to craft " + localizedName); cfg.craft.SettingChanged += delegate { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && (Object)(object)ObjectDB.instance.GetItemPrefab("YmirRemains") != (Object)null) { Requirement[] resources = SerializedRequirements.toPieceReqs(new SerializedRequirements(cfg.craft.Value)); piecePrefab.m_resources = resources; Piece[] array4 = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (Piece val in array4) { if (val.m_name == pieceName) { val.m_resources = resources; } } } }; for (int num2 = 0; num2 < piece.Conversions.Count; num2++) { string text7 = ((piece.Conversions.Count > 1) ? $"{num2 + 1}. " : ""); Conversion conversion = piece.Conversions[num2]; conversion.config = new Conversion.ConversionConfig(); int index = num2; conversion.config.input = config(englishName, text7 + "Conversion Input Item", conversion.Input, new ConfigDescription("Conversion input item within " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName } })); conversion.config.input.SettingChanged += delegate { if (index < piece.conversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) { ItemDrop val = SerializedRequirements.fetchByName(instance, conversion.config.input.Value); piece.conversions[index].m_from = val; } } }; conversion.config.output = config(englishName, text7 + "Conversion Output Item", conversion.Output, new ConfigDescription("Conversion output item within " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName } })); conversion.config.output.SettingChanged += delegate { if (index < piece.conversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) { ItemDrop to = SerializedRequirements.fetchByName(instance, conversion.config.output.Value); piece.conversions[index].m_to = to; } } }; } void BuildTableConfigChanged(object o, EventArgs e) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (registeredPieces.Count > 0) { if (cfg.category.Value == BuildPieceCategory.Custom) { piecePrefab.m_category = PiecePrefabManager.GetCategory(cfg.customCategory.Value); } else { piecePrefab.m_category = (PieceCategory)cfg.category.Value; } if (Object.op_Implicit((Object)(object)Hud.instance)) { PiecePrefabManager.CategoryRefreshNeeded = true; PiecePrefabManager.CreateCategoryTabs(); } } customTableAttributes.Browsable = cfg.category.Value == BuildPieceCategory.Custom; ReloadConfigDisplay(); } void ExtensionTableConfigChanged(object o, EventArgs e) { if (piece.RequiredItems.Requirements.Count > 0) { CraftingTable value = cfg.extensionTable.Value; CraftingTable craftingTable = value; if (craftingTable == CraftingTable.Custom) { StationExtension obj = pieceExtensionComp; GameObject prefab = ZNetScene.instance.GetPrefab(cfg.customExtentionTable.Value); obj.m_craftingStation = ((prefab != null) ? prefab.GetComponent() : null); } else { pieceExtensionComp.m_craftingStation = ZNetScene.instance.GetPrefab(((InternalName)typeof(CraftingTable).GetMember(cfg.extensionTable.Value.ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName).GetComponent(); } pieceExtensionComp.m_maxStationDistance = cfg.maxStationDistance.Value; } customTableAttributes.Browsable = cfg.extensionTable.Value == CraftingTable.Custom; foreach (ConfigurationManagerAttributes item5 in hideWhenNoneAttributes) { item5.Browsable = cfg.extensionTable.Value != CraftingTable.None; } ReloadConfigDisplay(); plugin.Config.Save(); } void TableConfigChanged(object o, EventArgs e) { if (piece.RequiredItems.Requirements.Count > 0) { switch (cfg.table.Value) { case CraftingTable.None: piecePrefab.m_craftingStation = null; break; case CraftingTable.Custom: { Piece obj = piecePrefab; GameObject prefab = ZNetScene.instance.GetPrefab(cfg.customTable.Value); obj.m_craftingStation = ((prefab != null) ? prefab.GetComponent() : null); break; } default: piecePrefab.m_craftingStation = ZNetScene.instance.GetPrefab(((InternalName)typeof(CraftingTable).GetMember(cfg.table.Value.ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName).GetComponent(); break; } } customTableAttributes.Browsable = cfg.table.Value == CraftingTable.Custom; foreach (ConfigurationManagerAttributes item6 in hideWhenNoneAttributes2) { item6.Browsable = cfg.table.Value != CraftingTable.None; } ReloadConfigDisplay(); plugin.Config.Save(); } ConfigEntry itemConfig(string name, string value, string desc) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes6 = new ConfigurationManagerAttributes { CustomDrawer = DrawConfigTable, Order = (order -= 1), Category = localizedName }; return config(englishName, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes6 })); } } foreach (BuildPiece registeredPiece3 in registeredPieces) { ConfigEntryBase enabledCfg = registeredPiece3.RecipeIsActive; Piece piecePrefab2; if (enabledCfg != null) { piecePrefab2 = registeredPiece3.Prefab.GetComponent(); ConfigChanged(null, null); ((object)enabledCfg).GetType().GetEvent("SettingChanged").AddEventHandler(enabledCfg, new EventHandler(ConfigChanged)); } registeredPiece3.InitializeNewRegisteredPiece(registeredPiece3); void ConfigChanged(object? o, EventArgs? e) { piecePrefab2.m_enabled = (int)enabledCfg.BoxedValue != 0; } } if (saveOnConfigSet) { plugin.Config.SaveOnConfigSet = true; plugin.Config.Save(); } void ReloadConfigDisplay() { if (configManagerType?.GetProperty("DisplayingWindow").GetValue(configManager) is int num3 && num3 != 0) { configManagerType.GetMethod("BuildSettingList").Invoke(configManager, Array.Empty()); } } } private void InitializeNewRegisteredPiece(BuildPiece piece) { ConfigEntryBase recipeIsActive = piece.RecipeIsActive; PieceConfig cfg; Piece piecePrefab; string pieceName; if (recipeIsActive != null) { pieceConfigs.TryGetValue(piece, out cfg); piecePrefab = piece.Prefab.GetComponent(); pieceName = piecePrefab.m_name; ((object)recipeIsActive).GetType().GetEvent("SettingChanged").AddEventHandler(recipeIsActive, new EventHandler(ConfigChanged)); } void ConfigChanged(object o, EventArgs e) { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && (Object)(object)ObjectDB.instance.GetItemPrefab("YmirRemains") != (Object)null && cfg != null) { Requirement[] resources = SerializedRequirements.toPieceReqs(new SerializedRequirements(cfg.craft.Value)); piecePrefab.m_resources = resources; Piece[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (Piece val in array) { if (val.m_name == pieceName) { val.m_resources = resources; } } } } } [HarmonyPriority(700)] internal static void Patch_ObjectDBInit(ObjectDB __instance) { //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Expected O, but got Unknown if ((Object)(object)__instance.GetItemPrefab("YmirRemains") == (Object)null) { return; } foreach (BuildPiece registeredPiece in registeredPieces) { pieceConfigs.TryGetValue(registeredPiece, out PieceConfig value); registeredPiece.Prefab.GetComponent().m_resources = SerializedRequirements.toPieceReqs((value == null) ? new SerializedRequirements(registeredPiece.RequiredItems.Requirements) : new SerializedRequirements(value.craft.Value)); foreach (ExtensionConfig extensionStation in registeredPiece.Extension.ExtensionStations) { switch ((value == null || registeredPiece.Extension.ExtensionStations.Count > 1) ? extensionStation.Table : value.extensionTable.Value) { case CraftingTable.None: registeredPiece.Prefab.GetComponent().m_craftingStation = null; break; case CraftingTable.Custom: { GameObject prefab = ZNetScene.instance.GetPrefab((value == null || registeredPiece.Extension.ExtensionStations.Count > 0) ? extensionStation.custom : value.customExtentionTable.Value); if (prefab != null) { registeredPiece.Prefab.GetComponent().m_craftingStation = prefab.GetComponent(); } else { Debug.LogWarning((object)("Custom crafting station '" + ((value == null || registeredPiece.Extension.ExtensionStations.Count > 0) ? extensionStation.custom : value.customExtentionTable.Value) + "' does not exist")); } break; } default: if (value != null && value.table.Value == CraftingTable.None) { registeredPiece.Prefab.GetComponent().m_craftingStation = null; } else { registeredPiece.Prefab.GetComponent().m_craftingStation = ZNetScene.instance.GetPrefab(((InternalName)typeof(CraftingTable).GetMember(((value == null || registeredPiece.Extension.ExtensionStations.Count > 1) ? extensionStation.Table : value.extensionTable.Value).ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName).GetComponent(); } break; } } foreach (CraftingStationConfig station in registeredPiece.Crafting.Stations) { switch ((value == null || registeredPiece.Crafting.Stations.Count > 1) ? station.Table : value.table.Value) { case CraftingTable.None: registeredPiece.Prefab.GetComponent().m_craftingStation = null; break; case CraftingTable.Custom: { GameObject prefab2 = ZNetScene.instance.GetPrefab((value == null || registeredPiece.Crafting.Stations.Count > 0) ? station.custom : value.customTable.Value); if (prefab2 != null) { registeredPiece.Prefab.GetComponent().m_craftingStation = prefab2.GetComponent(); } else { Debug.LogWarning((object)("Custom crafting station '" + ((value == null || registeredPiece.Crafting.Stations.Count > 0) ? station.custom : value.customTable.Value) + "' does not exist")); } break; } default: if (value != null && value.table.Value == CraftingTable.None) { registeredPiece.Prefab.GetComponent().m_craftingStation = null; } else { registeredPiece.Prefab.GetComponent().m_craftingStation = ZNetScene.instance.GetPrefab(((InternalName)typeof(CraftingTable).GetMember(((value == null || registeredPiece.Crafting.Stations.Count > 1) ? station.Table : value.table.Value).ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName).GetComponent(); } break; } } registeredPiece.conversions = new List(); for (int i = 0; i < registeredPiece.Conversions.Count; i++) { Conversion conversion = registeredPiece.Conversions[i]; registeredPiece.conversions.Add(new ItemConversion { m_from = SerializedRequirements.fetchByName(ObjectDB.instance, conversion.config?.input.Value ?? conversion.Input), m_to = SerializedRequirements.fetchByName(ObjectDB.instance, conversion.config?.output.Value ?? conversion.Output) }); if (registeredPiece.conversions[i].m_from != null && registeredPiece.conversions[i].m_to != null) { registeredPiece.Prefab.GetComponent().m_conversion.Add(registeredPiece.conversions[i]); } } } } public void Snapshot(float lightIntensity = 1.3f, Quaternion? cameraRotation = null) { QueueSnapshot(Prefab, lightIntensity, cameraRotation); } internal void QueueSnapshot(GameObject prefab, float lightIntensity, Quaternion? cameraRotation = null) { _snapshotQueue.Enqueue((prefab, lightIntensity, cameraRotation)); } internal static void KickoffQueuedSnapshots() { if (_snapshotQueue.Count != 0) { BaseUnityPlugin? obj = _plugin; if (obj != null) { ((MonoBehaviour)obj).StartCoroutine(RunQueuedSnapshots()); } } } private static IEnumerator RunQueuedSnapshots() { yield return null; WaitForEndOfFrame eof = new WaitForEndOfFrame(); yield return eof; while (_snapshotQueue.Count > 0) { var (prefab, intensity, rot) = _snapshotQueue.Dequeue(); yield return eof; if (!Application.isBatchMode && Object.op_Implicit((Object)(object)prefab)) { try { SnapshotPiece(prefab, intensity, rot); } catch (Exception ex) { Exception ex2 = ex; Debug.LogError((object)$"[PieceManager] Snapshot failed for '{((Object)prefab).name}': {ex2}"); } } } } internal static void SnapshotPiece(GameObject prefab, float lightIntensity = 1.3f, Quaternion? cameraRotation = null) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Expected O, but got Unknown //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)prefab == (Object)null) && (prefab.GetComponentsInChildren().Any() || prefab.GetComponentsInChildren().Any())) { Camera component = new GameObject("CameraIcon", new Type[1] { typeof(Camera) }).GetComponent(); component.backgroundColor = Color.clear; component.clearFlags = (CameraClearFlags)2; ((Component)component).transform.position = new Vector3(10000f, 10000f, 10000f); ((Component)component).transform.rotation = (Quaternion)(((??)cameraRotation) ?? Quaternion.Euler(0f, 180f, 0f)); component.fieldOfView = 0.5f; component.farClipPlane = 100000f; component.cullingMask = 8; Light component2 = new GameObject("LightIcon", new Type[1] { typeof(Light) }).GetComponent(); ((Component)component2).transform.position = new Vector3(10000f, 10000f, 10000f); ((Component)component2).transform.rotation = Quaternion.Euler(5f, 180f, 5f); component2.type = (LightType)1; component2.cullingMask = 8; component2.intensity = lightIntensity; GameObject val = Object.Instantiate(prefab); Transform[] componentsInChildren = val.GetComponentsInChildren(); foreach (Transform val2 in componentsInChildren) { ((Component)val2).gameObject.layer = 3; } val.transform.position = Vector3.zero; val.transform.rotation = Quaternion.Euler(23f, 51f, 25.8f); ((Object)val).name = ((Object)prefab).name; MeshRenderer[] componentsInChildren2 = val.GetComponentsInChildren(); Vector3 val3 = componentsInChildren2.Aggregate(Vector3.positiveInfinity, delegate(Vector3 cur, MeshRenderer renderer) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = ((Renderer)renderer).bounds; return Vector3.Min(cur, ((Bounds)(ref bounds)).min); }); Vector3 val4 = componentsInChildren2.Aggregate(Vector3.negativeInfinity, delegate(Vector3 cur, MeshRenderer renderer) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = ((Renderer)renderer).bounds; return Vector3.Max(cur, ((Bounds)(ref bounds)).max); }); val.transform.position = new Vector3(10000f, 10000f, 10000f) - (val3 + val4) / 2f; Vector3 val5 = val4 - val3; TimedDestruction val6 = val.AddComponent(); val6.Trigger(1f); Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(0f, 0f, 128f, 128f); component.targetTexture = RenderTexture.GetTemporary((int)((Rect)(ref val7)).width, (int)((Rect)(ref val7)).height); component.fieldOfView = 20f; float num = Mathf.Max(val5.x, val5.y) + 0.1f; float num2 = num / Mathf.Tan(component.fieldOfView * ((float)Math.PI / 180f)) * 1.1f; ((Component)component).transform.position = new Vector3(10000f, 10000f, 10000f) + new Vector3(0f, 0f, num2); component.Render(); RenderTexture active = RenderTexture.active; RenderTexture.active = component.targetTexture; Texture2D val8 = new Texture2D((int)((Rect)(ref val7)).width, (int)((Rect)(ref val7)).height, (TextureFormat)4, false); val8.ReadPixels(new Rect(0f, 0f, (float)(int)((Rect)(ref val7)).width, (float)(int)((Rect)(ref val7)).height), 0, 0); val8.Apply(); RenderTexture.active = active; prefab.GetComponent().m_icon = Sprite.Create(val8, new Rect(0f, 0f, (float)(int)((Rect)(ref val7)).width, (float)(int)((Rect)(ref val7)).height), Vector2.one / 2f); ((Component)component2).gameObject.SetActive(false); component.targetTexture.Release(); ((Component)component).gameObject.SetActive(false); val.SetActive(false); Object.DestroyImmediate((Object)(object)val); Object.Destroy((Object)(object)component); Object.Destroy((Object)(object)component2); Object.Destroy((Object)(object)((Component)component).gameObject); Object.Destroy((Object)(object)((Component)component2).gameObject); } } private static void DrawConfigTable(ConfigEntryBase cfg) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown bool valueOrDefault = cfg.Description.Tags.Select((object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : ((bool?)null)).FirstOrDefault((bool? v) => v.HasValue) == true; List list = new List(); bool flag = false; int num = (int)(configManager?.GetType().GetProperty("RightColumnWidth", BindingFlags.Instance | BindingFlags.NonPublic).GetGetMethod(nonPublic: true) .Invoke(configManager, Array.Empty()) ?? ((object)130)); GUILayout.BeginVertical(Array.Empty()); foreach (Requirement req in new SerializedRequirements((string)cfg.BoxedValue).Reqs) { GUILayout.BeginHorizontal(Array.Empty()); int num2 = req.amount; if (int.TryParse(GUILayout.TextField(num2.ToString(), new GUIStyle(GUI.skin.textField) { fixedWidth = 40f }, Array.Empty()), out var result) && result != num2 && !valueOrDefault) { num2 = result; flag = true; } string text = GUILayout.TextField(req.itemName, new GUIStyle(GUI.skin.textField) { fixedWidth = num - 40 - 67 - 21 - 21 - 12 }, Array.Empty()); string text2 = (valueOrDefault ? req.itemName : text); flag = flag || text2 != req.itemName; bool flag2 = req.recover; if (GUILayout.Toggle(req.recover, "Recover", new GUIStyle(GUI.skin.toggle) { fixedWidth = 67f }, Array.Empty()) != req.recover) { flag2 = !flag2; flag = true; } if (GUILayout.Button("x", new GUIStyle(GUI.skin.button) { fixedWidth = 21f }, Array.Empty()) && !valueOrDefault) { flag = true; } else { list.Add(new Requirement { amount = num2, itemName = text2, recover = flag2 }); } if (GUILayout.Button("+", new GUIStyle(GUI.skin.button) { fixedWidth = 21f }, Array.Empty()) && !valueOrDefault) { flag = true; list.Add(new Requirement { amount = 1, itemName = "", recover = false }); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (flag) { cfg.BoxedValue = new SerializedRequirements(list).ToString(); } } private static ConfigEntry config(string group, string name, T value, ConfigDescription description) { ConfigEntry val = plugin.Config.Bind(group, name, value, description); configSync?.GetType().GetMethod("AddConfigEntry").MakeGenericMethod(typeof(T)) .Invoke(configSync, new object[1] { val }); return val; } private static ConfigEntry config(string group, string name, T value, string description) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty())); } } public static class GoExtensions { public static T GetOrAddComponent(this GameObject gameObject) where T : Component { return gameObject.GetComponent() ?? gameObject.AddComponent(); } } [PublicAPI] public class LocalizeKey { private static readonly List keys = new List(); public readonly string Key; public readonly Dictionary Localizations = new Dictionary(); public LocalizeKey(string key) { Key = key.Replace("$", ""); keys.Add(this); } public void Alias(string alias) { Localizations.Clear(); if (!alias.Contains("$")) { alias = "$" + alias; } Localizations["alias"] = alias; if (Localization.m_instance != null) { Localization.instance.AddWord(Key, Localization.instance.Localize(alias)); } } public LocalizeKey English(string key) { return addForLang("English", key); } public LocalizeKey Swedish(string key) { return addForLang("Swedish", key); } public LocalizeKey French(string key) { return addForLang("French", key); } public LocalizeKey Italian(string key) { return addForLang("Italian", key); } public LocalizeKey German(string key) { return addForLang("German", key); } public LocalizeKey Spanish(string key) { return addForLang("Spanish", key); } public LocalizeKey Russian(string key) { return addForLang("Russian", key); } public LocalizeKey Romanian(string key) { return addForLang("Romanian", key); } public LocalizeKey Bulgarian(string key) { return addForLang("Bulgarian", key); } public LocalizeKey Macedonian(string key) { return addForLang("Macedonian", key); } public LocalizeKey Finnish(string key) { return addForLang("Finnish", key); } public LocalizeKey Danish(string key) { return addForLang("Danish", key); } public LocalizeKey Norwegian(string key) { return addForLang("Norwegian", key); } public LocalizeKey Icelandic(string key) { return addForLang("Icelandic", key); } public LocalizeKey Turkish(string key) { return addForLang("Turkish", key); } public LocalizeKey Lithuanian(string key) { return addForLang("Lithuanian", key); } public LocalizeKey Czech(string key) { return addForLang("Czech", key); } public LocalizeKey Hungarian(string key) { return addForLang("Hungarian", key); } public LocalizeKey Slovak(string key) { return addForLang("Slovak", key); } public LocalizeKey Polish(string key) { return addForLang("Polish", key); } public LocalizeKey Dutch(string key) { return addForLang("Dutch", key); } public LocalizeKey Portuguese_European(string key) { return addForLang("Portuguese_European", key); } public LocalizeKey Portuguese_Brazilian(string key) { return addForLang("Portuguese_Brazilian", key); } public LocalizeKey Chinese(string key) { return addForLang("Chinese", key); } public LocalizeKey Japanese(string key) { return addForLang("Japanese", key); } public LocalizeKey Korean(string key) { return addForLang("Korean", key); } public LocalizeKey Hindi(string key) { return addForLang("Hindi", key); } public LocalizeKey Thai(string key) { return addForLang("Thai", key); } public LocalizeKey Abenaki(string key) { return addForLang("Abenaki", key); } public LocalizeKey Croatian(string key) { return addForLang("Croatian", key); } public LocalizeKey Georgian(string key) { return addForLang("Georgian", key); } public LocalizeKey Greek(string key) { return addForLang("Greek", key); } public LocalizeKey Serbian(string key) { return addForLang("Serbian", key); } public LocalizeKey Ukrainian(string key) { return addForLang("Ukrainian", key); } private LocalizeKey addForLang(string lang, string value) { Localizations[lang] = value; if (Localization.m_instance != null) { if (Localization.instance.GetSelectedLanguage() == lang) { Localization.instance.AddWord(Key, value); } else if (lang == "English" && !Localization.instance.m_translations.ContainsKey(Key)) { Localization.instance.AddWord(Key, value); } } return this; } [HarmonyPriority(300)] internal static void AddLocalizedKeys(Localization __instance, string language) { foreach (LocalizeKey key in keys) { string value2; if (key.Localizations.TryGetValue(language, out string value) || key.Localizations.TryGetValue("English", out value)) { __instance.AddWord(key.Key, value); } else if (key.Localizations.TryGetValue("alias", out value2)) { __instance.AddWord(key.Key, Localization.instance.Localize(value2)); } } } } public static class LocalizationCache { private static readonly Dictionary localizations = new Dictionary(); internal static void LocalizationPostfix(Localization __instance, string language) { string key = localizations.FirstOrDefault>((KeyValuePair l) => l.Value == __instance).Key; if (key != null) { localizations.Remove(key); } if (!localizations.ContainsKey(language)) { localizations.Add(language, __instance); } } public static Localization ForLanguage(string? language = null) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (localizations.TryGetValue(language ?? PlayerPrefs.GetString("language", "English"), out Localization value)) { return value; } value = new Localization(); if (language != null) { value.SetupLanguage(language); } return value; } } public class AdminSyncing { private static bool isServer; internal static bool registeredOnClient; [HarmonyPriority(700)] internal static void AdminStatusSync(ZNet __instance) { isServer = __instance.IsServer(); if (BuildPiece._plugin != null) { if (isServer) { ZRoutedRpc.instance.Register(BuildPiece._plugin.Info.Metadata.Name + " PMAdminStatusSync", (Action)RPC_AdminPieceAddRemove); } else if (!registeredOnClient) { ZRoutedRpc.instance.Register(BuildPiece._plugin.Info.Metadata.Name + " PMAdminStatusSync", (Action)RPC_AdminPieceAddRemove); registeredOnClient = true; } } if (isServer) { ((MonoBehaviour)ZNet.instance).StartCoroutine(WatchAdminListChanges()); } static void SendAdmin(List peers, bool isAdmin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write(isAdmin); ((MonoBehaviour)ZNet.instance).StartCoroutine(sendZPackage(peers, val)); } static IEnumerator WatchAdminListChanges() { List currentList = new List(ZNet.instance.m_adminList.GetList()); while (true) { yield return (object)new WaitForSeconds(30f); if (!ZNet.instance.m_adminList.GetList().SequenceEqual(currentList)) { currentList = new List(ZNet.instance.m_adminList.GetList()); List adminPeer = (from p in ZNet.instance.GetPeers() where ZNet.instance.ListContainsId(ZNet.instance.m_adminList, p.m_rpc.GetSocket().GetHostName()) select p).ToList(); List nonAdminPeer = ZNet.instance.GetPeers().Except(adminPeer).ToList(); SendAdmin(nonAdminPeer, isAdmin: false); SendAdmin(adminPeer, isAdmin: true); } } } } private static IEnumerator sendZPackage(List peers, ZPackage package) { if (!Object.op_Implicit((Object)(object)ZNet.instance)) { yield break; } byte[] rawData = package.GetArray(); if (rawData != null && rawData.LongLength > 10000) { ZPackage compressedPackage = new ZPackage(); compressedPackage.Write(4); MemoryStream output = new MemoryStream(); using (DeflateStream deflateStream = new DeflateStream(output, CompressionLevel.Optimal)) { deflateStream.Write(rawData, 0, rawData.Length); } compressedPackage.Write(output.ToArray()); package = compressedPackage; } List> writers = (from p in peers where p.IsReady() select TellPeerAdminStatus(p, package)).ToList(); writers.RemoveAll((IEnumerator writer) => !writer.MoveNext()); while (writers.Count > 0) { yield return null; writers.RemoveAll((IEnumerator writer) => !writer.MoveNext()); } } private static IEnumerator TellPeerAdminStatus(ZNetPeer peer, ZPackage package) { ZRoutedRpc rpc = ZRoutedRpc.instance; if (rpc != null) { SendPackage(package); } void SendPackage(ZPackage pkg) { BaseUnityPlugin? plugin = BuildPiece._plugin; string text = ((plugin != null) ? plugin.Info.Metadata.Name : null) + " PMAdminStatusSync"; if (isServer) { peer.m_rpc.Invoke(text, new object[1] { pkg }); } else { rpc.InvokeRoutedRPC(peer.m_server ? 0 : peer.m_uid, text, new object[1] { pkg }); } } yield break; } internal static void RPC_AdminPieceAddRemove(long sender, ZPackage package) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown ZNetPeer peer = ZNet.instance.GetPeer(sender); bool flag = false; try { flag = package.ReadBool(); } catch { } if (isServer) { ZRoutedRpc instance = ZRoutedRpc.instance; long everybody = ZRoutedRpc.Everybody; BaseUnityPlugin? plugin = BuildPiece._plugin; instance.InvokeRoutedRPC(everybody, ((plugin != null) ? plugin.Info.Metadata.Name : null) + " PMAdminStatusSync", new object[1] { (object)new ZPackage() }); if (ZNet.instance.ListContainsId(ZNet.instance.m_adminList, peer.m_rpc.GetSocket().GetHostName())) { ZPackage val = new ZPackage(); val.Write(true); ZRpc rpc = peer.m_rpc; BaseUnityPlugin? plugin2 = BuildPiece._plugin; rpc.Invoke(((plugin2 != null) ? plugin2.Info.Metadata.Name : null) + " PMAdminStatusSync", new object[1] { val }); } return; } foreach (BuildPiece registeredPiece in BuildPiece.registeredPieces) { if (!registeredPiece.SpecialProperties.AdminOnly) { continue; } Piece component = registeredPiece.Prefab.GetComponent(); string name = component.m_name; string text = Localization.instance.Localize(name).Trim(); if (!Object.op_Implicit((Object)(object)ObjectDB.instance) || (Object)(object)ObjectDB.instance.GetItemPrefab("YmirRemains") == (Object)null) { continue; } Piece[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (Piece val2 in array) { if (flag) { if (val2.m_name == name) { val2.m_enabled = true; } } else if (val2.m_name == name) { val2.m_enabled = false; } } List pieces = ObjectDB.instance.GetItemPrefab("Hammer").GetComponent().m_itemData.m_shared.m_buildPieces.m_pieces; if (flag) { if (!pieces.Contains(ZNetScene.instance.GetPrefab(((Object)component).name))) { pieces.Add(ZNetScene.instance.GetPrefab(((Object)component).name)); } } else if (pieces.Contains(ZNetScene.instance.GetPrefab(((Object)component).name))) { pieces.Remove(ZNetScene.instance.GetPrefab(((Object)component).name)); } } } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] internal class RegisterClientRPCPatch { private static void Postfix(ZNet __instance, ZNetPeer peer) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown if (!__instance.IsServer()) { ZRpc rpc = peer.m_rpc; BaseUnityPlugin? plugin = BuildPiece._plugin; rpc.Register(((plugin != null) ? plugin.Info.Metadata.Name : null) + " PMAdminStatusSync", (Action)RPC_InitialAdminSync); return; } ZPackage val = new ZPackage(); val.Write(__instance.ListContainsId(__instance.m_adminList, peer.m_rpc.GetSocket().GetHostName())); ZRpc rpc2 = peer.m_rpc; BaseUnityPlugin? plugin2 = BuildPiece._plugin; rpc2.Invoke(((plugin2 != null) ? plugin2.Info.Metadata.Name : null) + " PMAdminStatusSync", new object[1] { val }); } private static void RPC_InitialAdminSync(ZRpc rpc, ZPackage package) { AdminSyncing.RPC_AdminPieceAddRemove(0L, package); } } public static class PiecePrefabManager { private struct BundleId { [UsedImplicitly] public string assetBundleFileName; [UsedImplicitly] public string folderName; } private static readonly Dictionary bundleCache; private static readonly List piecePrefabs; private static readonly Dictionary PieceCategories; private static readonly Dictionary OtherPieceCategories; private static readonly Dictionary VanillaLabels; internal static bool CategoryRefreshNeeded; static PiecePrefabManager() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Expected O, but got Unknown //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_0327: Expected O, but got Unknown //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Expected O, but got Unknown //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Expected O, but got Unknown //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Expected O, but got Unknown //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Expected O, but got Unknown //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Expected O, but got Unknown bundleCache = new Dictionary(); piecePrefabs = new List(); PieceCategories = new Dictionary(); OtherPieceCategories = new Dictionary(); VanillaLabels = new Dictionary(); Harmony val = new Harmony("org.bepinex.helpers.PieceManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(BuildPiece), "Patch_FejdStartup", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(BuildPiece), "KickoffQueuedSnapshots", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(LocalizeKey), "AddLocalizedKeys", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "SetupLanguage", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(LocalizationCache), "LocalizationPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ObjectDB), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Patch_ObjectDBInit", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ObjectDB), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(BuildPiece), "Patch_ObjectDBInit", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ObjectDB), "CopyOtherDB", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Patch_ObjectDBInit", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZNet), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(AdminSyncing), "AdminStatusSync", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZNetScene), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Patch_ZNetSceneAwake", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZNetScene), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "RefFixPatch_ZNetSceneAwake", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(PieceTable), "UpdateAvailable", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "UpdateAvailable_Transpiler", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(PieceTable), "UpdateAvailable", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "UpdateAvailable_Prefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "UpdateAvailable_Postfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Player), "SetPlaceMode", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Patch_SetPlaceMode", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Hud), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Hud_AwakeCreateTabs", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Hud), "UpdateBuild", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "RepositionCatsIfNeeded", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Hud), "LateUpdate", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "RepositionCatsIfNeeded", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Enum), "GetValues", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "EnumGetValuesPatch", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Enum), "GetNames", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "EnumGetNamesPatch", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static AssetBundle RegisterAssetBundle(string assetBundleFileName, string folderName = "assets") { BundleId key = new BundleId { assetBundleFileName = assetBundleFileName, folderName = folderName }; if (!bundleCache.TryGetValue(key, out AssetBundle value)) { Dictionary dictionary = bundleCache; AssetBundle? obj = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((AssetBundle a) => ((Object)a).name == assetBundleFileName)) ?? AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetName().Name + "." + folderName + "." + assetBundleFileName)); AssetBundle result = obj; dictionary[key] = obj; return result; } return value; } public static IEnumerable FixRefs(AssetBundle assetBundle) { return assetBundle.LoadAllAssets(); } public static GameObject RegisterPrefab(string assetBundleFileName, string prefabName, string folderName = "assets") { return RegisterPrefab(RegisterAssetBundle(assetBundleFileName, folderName), prefabName); } public static GameObject RegisterPrefab(AssetBundle assets, string prefabName) { if ((Object)(object)assets == (Object)null) { Debug.LogError((object)"Failed to load asset bundle. Please make sure to mark all asset bundles as embedded resources."); return null; } GameObject val = assets.LoadAsset(prefabName); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("Failed to load prefab " + prefabName + " from asset bundle " + ((Object)assets).name)); return null; } piecePrefabs.Add(val); return val; } public static Sprite RegisterSprite(string assetBundleFileName, string prefabName, string folderName = "assets") { return RegisterSprite(RegisterAssetBundle(assetBundleFileName, folderName), prefabName); } public static Sprite RegisterSprite(AssetBundle assets, string prefabName) { return assets.LoadAsset(prefabName); } private static void EnumGetValuesPatch(Type enumType, ref Array __result) { if (!(enumType != typeof(PieceCategory)) && PieceCategories.Count != 0) { PieceCategory[] array = (PieceCategory[])(object)new PieceCategory[__result.Length + PieceCategories.Count]; __result.CopyTo(array, 0); PieceCategories.Values.CopyTo(array, __result.Length); __result = array; } } private static void EnumGetNamesPatch(Type enumType, ref string[] __result) { if (!(enumType != typeof(PieceCategory)) && PieceCategories.Count != 0) { __result = CollectionExtensions.AddRangeToArray(__result, PieceCategories.Keys.ToArray()); } } public static Dictionary GetPieceCategoriesMap() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) Array values = Enum.GetValues(typeof(PieceCategory)); string[] names = Enum.GetNames(typeof(PieceCategory)); Dictionary dictionary = new Dictionary(); for (int i = 0; i < values.Length; i++) { dictionary[(PieceCategory)values.GetValue(i)] = names[i]; } return dictionary; } public static PieceCategory GetCategory(string name) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if (Enum.TryParse(name, ignoreCase: true, out PieceCategory result)) { return result; } if (PieceCategories.TryGetValue(name, out result)) { return result; } if (OtherPieceCategories.TryGetValue(name, out result)) { return result; } Dictionary pieceCategoriesMap = GetPieceCategoriesMap(); foreach (KeyValuePair item in pieceCategoriesMap) { if (item.Value == name) { result = item.Key; OtherPieceCategories[name] = result; return result; } } result = (PieceCategory)(pieceCategoriesMap.Count - 1); PieceCategories[name] = result; string categoryToken = GetCategoryToken(name); Localization.instance.AddWord(categoryToken, name); return result; } internal static void CreateCategoryTabs() { if (Object.op_Implicit((Object)(object)Hud.instance)) { int num = ModifiedMaxCategory(); for (int i = Hud.instance.m_pieceCategoryTabs.Length; i < num; i++) { GameObject val = CreateCategoryTab(); Hud.instance.m_pieceCategoryTabs = CollectionExtensions.AddItem((IEnumerable)Hud.instance.m_pieceCategoryTabs, val).ToArray(); } if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Player.m_localPlayer.m_buildPieces)) { RepositionCategories(Player.m_localPlayer.m_buildPieces); Player.m_localPlayer.UpdateAvailablePiecesList(); } } } private static GameObject CreateCategoryTab() { //IL_0084: 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) GameObject val = Hud.instance.m_pieceCategoryTabs[0]; GameObject val2 = Object.Instantiate(Hud.instance.m_pieceCategoryTabs[0], val.transform.parent); val2.SetActive(false); UIInputHandler orAddComponent = val2.GetOrAddComponent(); orAddComponent.m_onLeftDown = (Action)Delegate.Combine(orAddComponent.m_onLeftDown, new Action(Hud.instance.OnLeftClickCategory)); TMP_Text[] componentsInChildren = val2.GetComponentsInChildren(); foreach (TMP_Text val3 in componentsInChildren) { val3.rectTransform.offsetMin = new Vector2(3f, 1f); val3.rectTransform.offsetMax = new Vector2(-3f, -1f); val3.enableAutoSizing = true; val3.fontSizeMin = 12f; val3.fontSizeMax = 20f; val3.lineSpacing = 0.8f; val3.textWrappingMode = (TextWrappingModes)1; val3.overflowMode = (TextOverflowModes)3; } return val2; } private static int ModifiedMaxCategory() { return Enum.GetValues(typeof(PieceCategory)).Length - 1; } private static int GetMaxCategoryOrDefault() { try { return (int)Enum.Parse(typeof(PieceCategory), "Max"); } catch (ArgumentException) { Debug.LogWarning((object)"Could not find Piece.PieceCategory.Max, using fallback value 4"); return 4; } } private static List TranspileMaxCategory(IEnumerable instructions, int maxOffset) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown int num = GetMaxCategoryOrDefault() + maxOffset; List list = new List(); foreach (CodeInstruction instruction in instructions) { if (CodeInstructionExtensions.LoadsConstant(instruction, (long)num)) { list.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "ModifiedMaxCategory", (Type[])null, (Type[])null))); if (maxOffset != 0) { list.Add(new CodeInstruction(OpCodes.Ldc_I4, (object)maxOffset)); list.Add(new CodeInstruction(OpCodes.Add, (object)null)); } } else { list.Add(instruction); } } return list; } private static IEnumerable UpdateAvailable_Transpiler(IEnumerable instructions) { return TranspileMaxCategory(instructions, 0); } private static HashSet CategoriesInPieceTable(PieceTable pieceTable) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); Piece val = default(Piece); foreach (GameObject item in pieceTable.m_pieces.Where((GameObject pieceFab) => (Object)(object)pieceFab != (Object)null)) { if (item.TryGetComponent(ref val)) { hashSet.Add(val.m_category); } } return hashSet; } private static void RepositionCatsIfNeeded() { if (CategoryRefreshNeeded) { CategoryRefreshNeeded = false; CreateCategoryTabs(); RepositionCats(); } } private static void RepositionCats() { if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Player.m_localPlayer.m_buildPieces)) { RepositionCategories(Player.m_localPlayer.m_buildPieces); } } private static void RepositionCategories(PieceTable pieceTable) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)Hud.instance.m_pieceCategoryTabs[0].transform; RectTransform val2 = (RectTransform)Hud.instance.m_pieceCategoryRoot.transform; RectTransform val3 = (RectTransform)Hud.instance.m_pieceSelectionWindow.transform; HorizontalLayoutGroup val4 = default(HorizontalLayoutGroup); if (((Component)((Transform)val).parent).TryGetComponent(ref val4)) { Object.DestroyImmediate((Object)(object)val4); } Rect rect = val.rect; Vector2 size = ((Rect)(ref rect)).size; GridLayoutGroup val6 = default(GridLayoutGroup); GridLayoutGroup val5 = (((Component)((Transform)val).parent).TryGetComponent(ref val6) ? val6 : ((Component)((Transform)val).parent).gameObject.AddComponent()); val5.cellSize = size; val5.spacing = new Vector2(0f, 1f); val5.constraint = (Constraint)1; val5.constraintCount = 5; ((LayoutGroup)val5).childAlignment = (TextAnchor)4; HashSet hashSet = CategoriesInPieceTable(pieceTable); UpdatePieceTableCategories(pieceTable, hashSet); rect = val2.rect; int num = Mathf.Max((int)(((Rect)(ref rect)).width / size.x), 1); int count = pieceTable.m_categories.Count; float num2 = (0f - size.x) * (float)num / 2f + size.x / 2f; float num3 = (size.y + 1f) * Mathf.Floor((float)(count - 1) / (float)num) + 5f; Vector2 val7 = default(Vector2); ((Vector2)(ref val7))..ctor(num2, num3); int num4 = Mathf.CeilToInt((float)count / (float)num); float num5 = (size.y + 1f) * (float)num4; RectTransform component = ((Component)((Transform)val).parent).GetComponent(); component.anchoredPosition = new Vector2(component.anchoredPosition.x, num5 / 2f); int num6 = 0; for (int i = 0; i < Hud.instance.m_pieceCategoryTabs.Length; i++) { GameObject val8 = Hud.instance.m_pieceCategoryTabs[i]; if ((Object)(object)val8 == (Object)null) { continue; } if (i >= pieceTable.m_categories.Count) { val8.SetActive(false); continue; } PieceCategory item = pieceTable.m_categories[i]; string text = pieceTable.m_categoryLabels[i]; if (hashSet.Contains(item)) { num6++; } val8.GetComponentInChildren().text = Localization.instance.Localize(text); } Transform obj = ((Transform)val3).Find("Bkg2"); RectTransform val9 = (RectTransform)((obj != null) ? ((Component)obj).transform : null); if (Object.op_Implicit((Object)(object)val9)) { float num7 = (size.y + 1f) * (float)Mathf.Max(0, Mathf.FloorToInt((float)(num6 - 1) / (float)num)); val9.offsetMax = new Vector2(val9.offsetMax.x, num7); } else { Debug.LogWarning((object)"RefreshCategories: Could not find background image"); } ((Component)Hud.instance).GetComponentInParent().RefreshLocalization(); } private static void UpdatePieceTableCategories(PieceTable pieceTable, HashSet visibleCategories) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < GetMaxCategoryOrDefault(); i++) { PieceCategory val = (PieceCategory)i; if (visibleCategories.Contains(val) && !pieceTable.m_categories.Contains(val)) { pieceTable.m_categories.Add(val); pieceTable.m_categoryLabels.Add(GetVanillaLabel(val)); } if (!visibleCategories.Contains(val) && pieceTable.m_categories.Contains(val)) { int index = pieceTable.m_categories.IndexOf(val); pieceTable.m_categories.RemoveAt(index); pieceTable.m_categoryLabels.RemoveAt(index); } } foreach (KeyValuePair pieceCategory in PieceCategories) { string key = pieceCategory.Key; PieceCategory value = pieceCategory.Value; if (visibleCategories.Contains(value) && !pieceTable.m_categories.Contains(value)) { pieceTable.m_categories.Add(value); pieceTable.m_categoryLabels.Add("$" + GetCategoryToken(key)); } if (visibleCategories.Contains(value) && !pieceTable.m_categoryLabels.Contains("$" + GetCategoryToken(key))) { pieceTable.m_categoryLabels.Add("$" + GetCategoryToken(key)); } if (!visibleCategories.Contains(value) && pieceTable.m_categories.Contains(value)) { int index2 = pieceTable.m_categories.IndexOf(value); pieceTable.m_categories.RemoveAt(index2); pieceTable.m_categoryLabels.RemoveAt(index2); } } } private static string GetVanillaLabel(PieceCategory category) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (!VanillaLabels.ContainsKey(category)) { SearchVanillaLabels(); } string value; return VanillaLabels.TryGetValue(category, out value) ? value : string.Empty; } private static void SearchVanillaLabels() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) PieceTable[] array = Resources.FindObjectsOfTypeAll(); foreach (PieceTable val in array) { for (int j = 0; j < val.m_categories.Count; j++) { PieceCategory key = val.m_categories[j]; if (j < val.m_categoryLabels.Count && !VanillaLabels.ContainsKey(key) && !string.IsNullOrEmpty(val.m_categoryLabels[j])) { VanillaLabels[key] = val.m_categoryLabels[j]; } } } } private static string GetCategoryToken(string name) { char[] endChars = Localization.instance.m_endChars; string text = string.Concat(name.ToLower().Split(endChars)); return "piecemanager_cat_" + text; } private static void Patch_SetPlaceMode(Player __instance) { if (Object.op_Implicit((Object)(object)__instance.m_buildPieces)) { RepositionCategories(__instance.m_buildPieces); } } private static void UpdateAvailable_Prefix(PieceTable __instance) { if (__instance.m_availablePieces.Count > 0) { int num = ModifiedMaxCategory() - __instance.m_availablePieces.Count; for (int i = 0; i < num; i++) { __instance.m_availablePieces.Add(new List()); } } } private static void UpdateAvailable_Postfix(PieceTable __instance) { Array.Resize(ref __instance.m_selectedPiece, __instance.m_availablePieces.Count); Array.Resize(ref __instance.m_lastSelectedPiece, __instance.m_availablePieces.Count); } [HarmonyPriority(200)] private static void Hud_AwakeCreateTabs() { CreateCategoryTabs(); } [HarmonyPriority(700)] private static void Patch_ZNetSceneAwake(ZNetScene __instance) { foreach (GameObject piecePrefab in piecePrefabs) { if (!__instance.m_prefabs.Contains(piecePrefab)) { __instance.m_prefabs.Add(piecePrefab); } } } [HarmonyPriority(700)] private static void RefFixPatch_ZNetSceneAwake(ZNetScene __instance) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject piecePrefab in piecePrefabs) { if (__instance.m_prefabs.Contains(piecePrefab) && Object.op_Implicit((Object)(object)piecePrefab.GetComponent())) { piecePrefab.GetComponent().m_isUpgrade = true; piecePrefab.GetComponent().m_connectionPrefab = __instance.GetPrefab("piece_workbench_ext3").GetComponent().m_connectionPrefab; piecePrefab.GetComponent().m_connectionOffset = __instance.GetPrefab("piece_workbench_ext3").GetComponent().m_connectionOffset; } } } [HarmonyPriority(300)] private static void Patch_ObjectDBInit(ObjectDB __instance) { foreach (BuildPiece registeredPiece in BuildPiece.registeredPieces) { string[] activeTools = registeredPiece.activeTools; foreach (string text in activeTools) { GameObject itemPrefab = __instance.GetItemPrefab(text); PieceTable val = ((itemPrefab != null) ? itemPrefab.GetComponent().m_itemData.m_shared.m_buildPieces : null); if (val != null && !val.m_pieces.Contains(registeredPiece.Prefab)) { val.m_pieces.Add(registeredPiece.Prefab); } } } } } public static class PieceManagerVersion { public const string Version = "1.2.10"; } [PublicAPI] public class Conversion { internal class ConversionConfig { public ConfigEntry input = null; public ConfigEntry output = null; } public string Input = null; public string Output = null; internal ConversionConfig? config; public Conversion(BuildPiece conversionPiece) { conversionPiece.Conversions.Add(this); } } [PublicAPI] public class SnapPointMaker { private static List _objectsToApplySnaps; static SnapPointMaker() { _objectsToApplySnaps = new List(); } public static void AddObjectForSnapPoints(GameObject obj) { _objectsToApplySnaps.Add(obj); } public static void ApplySnapPoints() { foreach (GameObject objectsToApplySnap in _objectsToApplySnaps) { GrabVerticesAssignSnaps(objectsToApplySnap); } } private static void GrabVerticesAssignSnaps(GameObject obj) { Vector3[] colliderVertexPosRotated = GetColliderVertexPosRotated(obj); AttachSnapPoints(obj, colliderVertexPosRotated); } private static Vector3[] GetColliderVertexPosRotated(GameObject obj) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[8]; BoxCollider componentInChildren = obj.GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { return array; } Transform transform = obj.transform; Vector3 val = componentInChildren.center - componentInChildren.size * 0.5f; Vector3 val2 = componentInChildren.center + componentInChildren.size * 0.5f; array[0] = transform.TransformPoint(new Vector3(val.x, val.y, val.z)); array[1] = transform.TransformPoint(new Vector3(val.x, val.y, val2.z)); array[2] = transform.TransformPoint(new Vector3(val.x, val2.y, val.z)); array[3] = transform.TransformPoint(new Vector3(val.x, val2.y, val2.z)); array[4] = transform.TransformPoint(new Vector3(val2.x, val.y, val.z)); array[5] = transform.TransformPoint(new Vector3(val2.x, val.y, val2.z)); array[6] = transform.TransformPoint(new Vector3(val2.x, val2.y, val.z)); array[7] = transform.TransformPoint(new Vector3(val2.x, val2.y, val2.z)); return array; } private static void AttachSnapPoints(GameObject objecttosnap, Vector3[] vector3S) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) foreach (Vector3 val in vector3S) { GameObject val2 = new GameObject(); ((Object)val2).name = "_snappoint"; val2.tag = "snappoint"; val2.layer = 10; GameObject val3 = Object.Instantiate(val2, val, Quaternion.identity, objecttosnap.transform); val3.SetActive(false); } } } } namespace LocalizationManager { [PublicAPI] public class Localizer { private static readonly Dictionary>> PlaceholderProcessors; private static readonly Dictionary> loadedTexts; private static readonly ConditionalWeakTable localizationLanguage; private static readonly List> localizationObjects; private static BaseUnityPlugin? _plugin; private static readonly List fileExtensions; private static BaseUnityPlugin plugin { get { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown if (_plugin == null) { IEnumerable source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } public static event Action? OnLocalizationComplete; private static void UpdatePlaceholderText(Localization localization, string key) { localizationLanguage.TryGetValue(localization, out string value); string text = loadedTexts[value][key]; if (PlaceholderProcessors.TryGetValue(key, out Dictionary> value2)) { text = value2.Aggregate(text, (string current, KeyValuePair> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder(string key, string placeholder, ConfigEntry config, Func? convertConfigValue = null) where T : notnull { if (convertConfigValue == null) { convertConfigValue = (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key)) { PlaceholderProcessors[key] = new Dictionary>(); } config.SettingChanged += delegate { UpdatePlaceholder(); }; if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage())) { UpdatePlaceholder(); } void UpdatePlaceholder() { PlaceholderProcessors[key][placeholder] = () => convertConfigValue(config.Value); UpdatePlaceholderText(Localization.instance, key); } } public static void AddText(string key, string text) { List> list = new List>(); foreach (WeakReference localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference item in list) { localizationObjects.Remove(item); } } public static void Load() { _ = plugin; } public static void LoadLocalizationLater(Localization __instance) { LoadLocalization(Localization.instance, __instance.GetSelectedLanguage()); } public static void SafeCallLocalizeComplete() { Localizer.OnLocalizationComplete?.Invoke(); } private static void LoadLocalization(Localization __instance, string language) { if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference(__instance)); } localizationLanguage.Add(__instance, language); Dictionary dictionary = new Dictionary(); foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories) where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0 select f) { string[] array = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' }); if (array.Length >= 2) { string text = array[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } } byte[] array2 = LoadTranslationFromAssembly("English"); if (array2 == null) { throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml."); } Dictionary dictionary2 = new DeserializerBuilder().IgnoreFields().Build().Deserialize>(Encoding.UTF8.GetString(array2)); if (dictionary2 == null) { throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty."); } string text2 = null; if (language != "English") { if (dictionary.TryGetValue(language, out var value)) { text2 = File.ReadAllText(value); } else { byte[] array3 = LoadTranslationFromAssembly(language); if (array3 != null) { text2 = Encoding.UTF8.GetString(array3); } } } if (text2 == null && dictionary.TryGetValue("English", out var value2)) { text2 = File.ReadAllText(value2); } if (text2 != null) { foreach (KeyValuePair item2 in new DeserializerBuilder().IgnoreFields().Build().Deserialize>(text2) ?? new Dictionary()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown PlaceholderProcessors = new Dictionary>>(); loadedTexts = new Dictionary>(); localizationLanguage = new ConditionalWeakTable(); localizationObjects = new List>(); fileExtensions = new List(2) { ".json", ".yml" }; Harmony val = new Harmony("org.bepinex.helpers.LocalizationManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "SetupLanguage", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "SetupGui", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalizationLater", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "SafeCallLocalizeComplete", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static byte[]? LoadTranslationFromAssembly(string language) { foreach (string fileExtension in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension); if (array != null) { return array; } } return null; } public static byte[]? ReadEmbeddedFileBytes(string resourceFileName, Assembly? containingAssembly = null) { using MemoryStream memoryStream = new MemoryStream(); if ((object)containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string text = containingAssembly.GetManifestResourceNames().FirstOrDefault((string str) => str.EndsWith(resourceFileName, StringComparison.Ordinal)); if (text != null) { containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream); } return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } public static class LocalizationManagerVersion { public const string Version = "1.4.1"; } } namespace ItemManager { [PublicAPI] public enum CraftingTable { Disabled, Inventory, [InternalName("piece_workbench")] Workbench, [InternalName("piece_cauldron")] Cauldron, [InternalName("piece_MeadCauldron")] MeadCauldron, [InternalName("forge")] Forge, [InternalName("piece_artisanstation")] ArtisanTable, [InternalName("piece_stonecutter")] StoneCutter, [InternalName("piece_magetable")] MageTable, [InternalName("piece_preptable")] PrepTable, [InternalName("blackforge")] BlackForge, Custom } [PublicAPI] public enum ConversionPiece { Disabled, [InternalName("smelter")] Smelter, [InternalName("charcoal_kiln")] CharcoalKiln, [InternalName("blastfurnace")] BlastFurnace, [InternalName("windmill")] Windmill, [InternalName("piece_spinningwheel")] SpinningWheel, [InternalName("eitrrefinery")] EitrRefinery, Custom } public class InternalName : Attribute { public readonly string internalName; public InternalName(string internalName) { this.internalName = internalName; } } [PublicAPI] public class RequiredResourceList { public readonly List Requirements = new List(); public bool Free = false; public void Add(string itemName, int amount, int quality = 0) { Requirements.Add(new Requirement { itemName = itemName, amount = amount, quality = quality }); } public void Add(string itemName, ConfigEntry amountConfig, int quality = 0) { Requirements.Add(new Requirement { itemName = itemName, amountConfig = amountConfig, quality = quality }); } } [PublicAPI] public class CraftingStationList { public readonly List Stations = new List(); public void Add(CraftingTable table, int level) { Stations.Add(new CraftingStationConfig { Table = table, level = level }); } public void Add(string customTable, int level) { Stations.Add(new CraftingStationConfig { Table = CraftingTable.Custom, level = level, custom = customTable }); } } [PublicAPI] public class ItemRecipe { public readonly RequiredResourceList RequiredItems = new RequiredResourceList(); public readonly RequiredResourceList RequiredUpgradeItems = new RequiredResourceList(); public readonly CraftingStationList Crafting = new CraftingStationList(); public int CraftAmount = 1; public bool RequireOnlyOneIngredient = false; public float QualityResultAmountMultiplier = 1f; public ConfigEntryBase? RecipeIsActive = null; } [PublicAPI] public class Trade { public Trader Trader = Trader.None; public uint Price = 0u; public uint Stack = 1u; public string? RequiredGlobalKey = null; } [PublicAPI] [Flags] public enum Trader { None = 0, Haldor = 1, Hildir = 2 } public struct Requirement { public string itemName; public int amount; public ConfigEntry? amountConfig; [Description("Set to a non-zero value to apply the requirement only for a specific quality")] public int quality; } public struct CraftingStationConfig { public CraftingTable Table; public int level; public string? custom; } [Flags] public enum Configurability { Disabled = 0, Recipe = 1, Stats = 2, Drop = 4, Trader = 8, Full = 0xF } [PublicAPI] public class DropTargets { public readonly List Drops = new List(); public void Add(string creatureName, float chance, int min = 1, int? max = null, bool levelMultiplier = true) { Drops.Add(new DropTarget { creature = creatureName, chance = chance, min = min, max = (max ?? min), levelMultiplier = levelMultiplier }); } } public struct DropTarget { public string creature; public int min; public int max; public float chance; public bool levelMultiplier; } public enum Toggle { On = 1, Off = 0 } [PublicAPI] public class Item { private class ItemConfig { public ConfigEntry? craft; public ConfigEntry? upgrade; public ConfigEntry table = null; public ConfigEntry tableLevel = null; public ConfigEntry customTable = null; public ConfigEntry? maximumTableLevel; public ConfigEntry requireOneIngredient = null; public ConfigEntry qualityResultAmountMultiplier = null; } private class TraderConfig { public ConfigEntry trader = null; public ConfigEntry price = null; public ConfigEntry stack = null; public ConfigEntry requiredGlobalKey = null; } private class RequirementQuality { public int quality; } private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] public string? Category; [UsedImplicitly] public Action? CustomDrawer; public Func? browsability; } [PublicAPI] public enum DamageModifier { Normal, Resistant, Weak, Immune, Ignore, VeryResistant, VeryWeak, None } private delegate void setDmgFunc(ref DamageTypes dmg, float value); private class SerializedRequirements { public readonly List Reqs; public SerializedRequirements(List reqs) { Reqs = reqs; } public SerializedRequirements(string reqs) : this(reqs.Split(new char[1] { ',' }).Select(delegate(string r) { string[] array = r.Split(new char[1] { ':' }); int result; int result2; return new Requirement { itemName = array[0], amount = ((array.Length <= 1 || !int.TryParse(array[1], out result)) ? 1 : result), quality = ((array.Length > 2 && int.TryParse(array[2], out result2)) ? result2 : 0) }; }).ToList()) { } public override string ToString() { return string.Join(",", Reqs.Select((Requirement r) => $"{r.itemName}:{r.amount}" + ((r.quality > 0) ? $":{r.quality}" : ""))); } public static ItemDrop? fetchByName(ObjectDB objectDB, string name) { GameObject itemPrefab = objectDB.GetItemPrefab(name); ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("The required item '" + name + "' does not exist.")); } return val; } public static Requirement[] toPieceReqs(ObjectDB objectDB, SerializedRequirements craft, SerializedRequirements upgrade) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01b7: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown Dictionary dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func)((Requirement r) => r.itemName), (Func)delegate(Requirement r) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) ItemDrop val6 = ResItem(r); return (val6 == null) ? ((Requirement)null) : new Requirement { m_amount = (r.amountConfig?.Value ?? r.amount), m_resItem = val6, m_amountPerLevel = 0 }; }); List list = dictionary.Values.Where((Requirement v) => v != null).ToList(); foreach (Requirement item in upgrade.Reqs.Where((Requirement r) => r.itemName != "")) { if (item.quality > 0) { ItemDrop val = ResItem(item); if (val != null) { Requirement val2 = new Requirement { m_resItem = val, m_amountPerLevel = (item.amountConfig?.Value ?? item.amount), m_amount = 0 }; list.Add(val2); requirementQuality.Add(val2, new RequirementQuality { quality = item.quality }); } continue; } if (!dictionary.TryGetValue(item.itemName, out var value) || value == null) { ItemDrop val3 = ResItem(item); if (val3 != null) { string itemName = item.itemName; Requirement val4 = new Requirement { m_resItem = val3, m_amount = 0 }; Requirement val5 = val4; dictionary[itemName] = val4; value = val5; list.Add(value); } } if (value != null) { value.m_amountPerLevel = item.amountConfig?.Value ?? item.amount; } } return list.ToArray(); ItemDrop? ResItem(Requirement r) { return fetchByName(objectDB, r.itemName); } } } private class SerializedDrop { public readonly List Drops; public SerializedDrop(List drops) { Drops = drops; } public SerializedDrop(string drops) { Drops = ((drops == "") ? ((IEnumerable)Array.Empty()) : ((IEnumerable)drops.Split(new char[1] { ',' }))).Select(delegate(string r) { string[] array = r.Split(new char[1] { ':' }); if (array.Length <= 2 || !int.TryParse(array[2], out var result)) { result = 1; } if (array.Length <= 3 || !int.TryParse(array[3], out var result2)) { result2 = result; } bool levelMultiplier = array.Length <= 4 || array[4] != "0"; float result3; return new DropTarget { creature = array[0], chance = ((array.Length > 1 && float.TryParse(array[1], out result3)) ? result3 : 1f), min = result, max = result2, levelMultiplier = levelMultiplier }; }).ToList(); } public override string ToString() { return string.Join(",", Drops.Select((DropTarget r) => $"{r.creature}:{r.chance.ToString(CultureInfo.InvariantCulture)}:{r.min}:" + ((r.min == r.max) ? "" : $"{r.max}") + (r.levelMultiplier ? "" : ":0"))); } private static Character? fetchByName(ZNetScene? netScene, string name) { if (!Object.op_Implicit((Object)(object)netScene)) { Debug.LogWarning((object)("The drop target character '" + name + "' cannot be checked because ZNetScene is not available.")); return null; } if (string.IsNullOrWhiteSpace(name)) { Debug.LogWarning((object)"A drop target character name is empty."); return null; } GameObject prefab = netScene.GetPrefab(name); Character val = ((prefab != null) ? prefab.GetComponent() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("The drop target character '" + name + "' does not exist.")); } return val; } public Dictionary toCharacterDrops(ZNetScene? netScene, GameObject? item) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown Dictionary dictionary = new Dictionary(); if (!Object.op_Implicit((Object)(object)item)) { Debug.LogWarning((object)"Creature drops cannot be assigned because the item prefab is missing."); return dictionary; } foreach (DropTarget drop in Drops) { Character val = fetchByName(netScene, drop.creature); if (val != null) { dictionary[val] = new Drop { m_prefab = item, m_amountMin = drop.min, m_amountMax = drop.max, m_chance = drop.chance, m_levelMultiplier = drop.levelMultiplier }; } } return dictionary; } } private static readonly List registeredItems = new List(); private static readonly Dictionary itemDropMap = new Dictionary(); private static Dictionary>> activeRecipes = new Dictionary>>(); private static Dictionary hiddenCraftRecipes = new Dictionary(); private static Dictionary hiddenUpgradeRecipes = new Dictionary(); private static Dictionary> itemCraftConfigs = new Dictionary>(); private static Dictionary> itemDropConfigs = new Dictionary>(); private Dictionary characterDrops = new Dictionary(); private readonly Dictionary statsConfigs = new Dictionary(); private static readonly ConditionalWeakTable requirementQuality = new ConditionalWeakTable(); public static Configurability DefaultConfigurability = Configurability.Full; public Configurability? Configurable = null; private Configurability configurationVisible = Configurability.Full; private TraderConfig? traderConfig; public readonly GameObject Prefab; [Description("Specifies the maximum required crafting station level to upgrade and repair the item.\nDefault is calculated from crafting station level and maximum quality.")] public int MaximumRequiredStationLevel = int.MaxValue; [Description("Assigns the item as a drop item to a creature.\nUses a creature name, a drop chance and a minimum and maximum amount.")] public readonly DropTargets DropsFrom = new DropTargets(); [Description("Configures whether the item can be bought at the trader.\nDon't forget to set cost to something above 0 or the item will be sold for free.")] public readonly Trade Trade = new Trade(); internal List Conversions = new List(); internal List conversions = new List(); public Dictionary Recipes = new Dictionary(); private LocalizeKey? _name; private LocalizeKey? _description; private static object? configManager; private static Localization? _english; private static BaseUnityPlugin? _plugin; private static bool hasConfigSync = true; private static object? _configSync; private Configurability configurability => Configurable ?? DefaultConfigurability; [Description("Specifies the resources needed to craft the item.\nUse .Add to add resources with their internal ID and an amount.\nUse one .Add for each resource type the item should need.")] public RequiredResourceList RequiredItems => this[""].RequiredItems; [Description("Specifies the resources needed to upgrade the item.\nUse .Add to add resources with their internal ID and an amount. This amount will be multipled by the item quality level.\nUse one .Add for each resource type the upgrade should need.")] public RequiredResourceList RequiredUpgradeItems => this[""].RequiredUpgradeItems; [Description("Specifies the crafting station needed to craft the item.\nUse .Add to add a crafting station, using the CraftingTable enum and a minimum level for the crafting station.\nUse one .Add for each crafting station.")] public CraftingStationList Crafting => this[""].Crafting; [Description("Specifies a config entry which toggles whether a recipe is active.")] public ConfigEntryBase? RecipeIsActive { get { return this[""].RecipeIsActive; } set { this[""].RecipeIsActive = value; } } [Description("Specifies the number of items that should be given to the player with a single craft of the item.\nDefaults to 1.")] public int CraftAmount { get { return this[""].CraftAmount; } set { this[""].CraftAmount = value; } } public bool RequireOnlyOneIngredient { get { return this[""].RequireOnlyOneIngredient; } set { this[""].RequireOnlyOneIngredient = value; } } public float QualityResultAmountMultiplier { get { return this[""].QualityResultAmountMultiplier; } set { this[""].QualityResultAmountMultiplier = value; } } public ItemRecipe this[string name] { get { if (Recipes.TryGetValue(name, out ItemRecipe value)) { return value; } return Recipes[name] = new ItemRecipe(); } } public LocalizeKey Name { get { LocalizeKey name = _name; if (name != null) { return name; } SharedData shared = Prefab.GetComponent().m_itemData.m_shared; if (shared.m_name.StartsWith("$")) { _name = new LocalizeKey(shared.m_name); } else { string text = "$item_" + ((Object)Prefab).name.Replace(" ", "_"); _name = new LocalizeKey(text).English(shared.m_name); shared.m_name = text; } return _name; } } public LocalizeKey Description { get { LocalizeKey description = _description; if (description != null) { return description; } SharedData shared = Prefab.GetComponent().m_itemData.m_shared; if (shared.m_description.StartsWith("$")) { _description = new LocalizeKey(shared.m_description); } else { string text = "$itemdesc_" + ((Object)Prefab).name.Replace(" ", "_"); _description = new LocalizeKey(text).English(shared.m_description); shared.m_description = text; } return _description; } } private static Localization english => _english ?? (_english = LocalizationCache.ForLanguage("English")); private static BaseUnityPlugin plugin { get { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown if (_plugin == null) { IEnumerable source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } private static object? configSync { get { if (_configSync == null && hasConfigSync) { Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync"); if ((object)type != null) { _configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " ItemManager"); type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString()); type.GetProperty("IsLocked").SetValue(_configSync, true); } else { hasConfigSync = false; } } return _configSync; } } public Item(string assetBundleFileName, string prefabName, string folderName = "assets") : this(PrefabManager.RegisterAssetBundle(assetBundleFileName, folderName), prefabName) { } public Item(AssetBundle bundle, string prefabName) : this(PrefabManager.RegisterPrefab(bundle, prefabName, addToObjectDb: true), skipRegistering: true) { } public Item(GameObject prefab, bool skipRegistering = false) { if ((Object)(object)prefab == (Object)null) { throw new InvalidOperationException("Cannot create an item from a missing prefab."); } if (!skipRegistering) { PrefabManager.RegisterPrefab(prefab, addToObjectDb: true); } Prefab = prefab; registeredItems.Add(this); ItemDrop component = Prefab.GetComponent(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException("Prefab '" + ((Object)Prefab).name + "' is registered as an item but has no ItemDrop component."); } itemDropMap[component] = this; component.m_itemData.m_dropPrefab = Prefab; } public void ToggleConfigurationVisibility(Configurability visible) { configurationVisible = visible; if (itemDropConfigs.TryGetValue(this, out ConfigEntry value)) { Toggle((ConfigEntryBase)(object)value, Configurability.Drop); } if (itemCraftConfigs.TryGetValue(this, out Dictionary value2)) { foreach (ItemConfig value4 in value2.Values) { ToggleObj(value4, Configurability.Recipe); } } foreach (Conversion conversion in Conversions) { if (conversion.config != null) { ToggleObj(conversion.config, Configurability.Recipe); } } foreach (KeyValuePair statsConfig in statsConfigs) { Toggle(statsConfig.Key, Configurability.Stats); if ((visible & Configurability.Stats) != Configurability.Disabled) { statsConfig.Value(); } } reloadConfigDisplay(); void Toggle(ConfigEntryBase cfg, Configurability check) { object[] tags = cfg.Description.Tags; foreach (object obj in tags) { if (obj is ConfigurationManagerAttributes configurationManagerAttributes) { configurationManagerAttributes.Browsable = (visible & check) != Configurability.Disabled && (configurationManagerAttributes.browsability == null || configurationManagerAttributes.browsability()); } } } void ToggleObj(object obj, Configurability check) { FieldInfo[] fields = obj.GetType().GetFields(); foreach (FieldInfo fieldInfo in fields) { object? value3 = fieldInfo.GetValue(obj); ConfigEntryBase val = (ConfigEntryBase)((value3 is ConfigEntryBase) ? value3 : null); if (val != null) { Toggle(val, check); } } } } internal static void reloadConfigDisplay() { if (configManager?.GetType().GetProperty("DisplayingWindow").GetValue(configManager) is int num && num != 0) { configManager.GetType().GetMethod("BuildSettingList").Invoke(configManager, Array.Empty()); } } private void UpdateItemTableConfig(string recipeKey, CraftingTable table, string customTableValue) { if (!activeRecipes.ContainsKey(this) || !activeRecipes[this].TryGetValue(recipeKey, out List value)) { return; } Recipe val = value.First(); val.m_enabled = table != CraftingTable.Disabled; if ((uint)table <= 1u) { val.m_craftingStation = null; return; } string text = ((table == CraftingTable.Custom) ? customTableValue : getInternalName(table)); ZNetScene instance = ZNetScene.instance; GameObject val2 = (Object.op_Implicit((Object)(object)instance) ? instance.GetPrefab(text) : null); if (Object.op_Implicit((Object)(object)val2)) { CraftingStation component = val2.GetComponent(); if (component != null) { val.m_craftingStation = component; return; } } val.m_craftingStation = null; val.m_enabled = false; Debug.LogWarning((object)("Crafting station '" + text + "' does not exist; disabling recipe '" + ((Object)val).name + "'.")); } private void UpdateCraftConfig(string recipeKey, SerializedRequirements craftRequirements, SerializedRequirements upgradeRequirements) { if (!Object.op_Implicit((Object)(object)ObjectDB.instance) || !activeRecipes.ContainsKey(this) || !activeRecipes[this].TryGetValue(recipeKey, out List value)) { return; } foreach (Recipe item in value) { item.m_resources = SerializedRequirements.toPieceReqs(ObjectDB.instance, craftRequirements, upgradeRequirements); } } internal static void Patch_FejdStartup() { //IL_1001: Unknown result type (might be due to invalid IL or missing references) //IL_1006: Unknown result type (might be due to invalid IL or missing references) //IL_2395: Unknown result type (might be due to invalid IL or missing references) //IL_239f: Expected O, but got Unknown //IL_10ce: Unknown result type (might be due to invalid IL or missing references) //IL_10d1: Unknown result type (might be due to invalid IL or missing references) //IL_1127: Expected I4, but got Unknown //IL_0ccc: Unknown result type (might be due to invalid IL or missing references) //IL_0cd6: Expected O, but got Unknown //IL_1267: Unknown result type (might be due to invalid IL or missing references) //IL_126a: Unknown result type (might be due to invalid IL or missing references) //IL_126c: Invalid comparison between Unknown and I4 //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Expected O, but got Unknown //IL_0dfa: Unknown result type (might be due to invalid IL or missing references) //IL_0e04: Expected O, but got Unknown //IL_0ea6: Unknown result type (might be due to invalid IL or missing references) //IL_0eb0: Expected O, but got Unknown //IL_1270: Unknown result type (might be due to invalid IL or missing references) //IL_1274: Invalid comparison between Unknown and I4 //IL_0f5b: Unknown result type (might be due to invalid IL or missing references) //IL_0f65: Expected O, but got Unknown //IL_1489: Unknown result type (might be due to invalid IL or missing references) //IL_148c: Unknown result type (might be due to invalid IL or missing references) //IL_148e: Invalid comparison between Unknown and I4 //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Expected O, but got Unknown //IL_1278: Unknown result type (might be due to invalid IL or missing references) //IL_127c: Invalid comparison between Unknown and I4 //IL_1492: Unknown result type (might be due to invalid IL or missing references) //IL_1496: Unknown result type (might be due to invalid IL or missing references) //IL_1498: Invalid comparison between Unknown and I4 //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Expected O, but got Unknown //IL_1581: Unknown result type (might be due to invalid IL or missing references) //IL_1586: Unknown result type (might be due to invalid IL or missing references) //IL_1588: Unknown result type (might be due to invalid IL or missing references) //IL_158b: Invalid comparison between Unknown and I4 //IL_149c: Unknown result type (might be due to invalid IL or missing references) //IL_14a0: Invalid comparison between Unknown and I4 //IL_158f: Unknown result type (might be due to invalid IL or missing references) //IL_1593: Invalid comparison between Unknown and I4 //IL_0796: Unknown result type (might be due to invalid IL or missing references) //IL_07a0: Expected O, but got Unknown //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Expected O, but got Unknown //IL_160c: Unknown result type (might be due to invalid IL or missing references) //IL_160f: Unknown result type (might be due to invalid IL or missing references) //IL_1611: Invalid comparison between Unknown and I4 //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_08ba: Expected O, but got Unknown //IL_1615: Unknown result type (might be due to invalid IL or missing references) //IL_1619: Unknown result type (might be due to invalid IL or missing references) //IL_161b: Invalid comparison between Unknown and I4 //IL_176e: Unknown result type (might be due to invalid IL or missing references) //IL_1771: Invalid comparison between Unknown and I4 //IL_161f: Unknown result type (might be due to invalid IL or missing references) //IL_1623: Invalid comparison between Unknown and I4 //IL_1980: Unknown result type (might be due to invalid IL or missing references) //IL_1987: Invalid comparison between Unknown and I4 //IL_1a5c: Unknown result type (might be due to invalid IL or missing references) //IL_1a61: Unknown result type (might be due to invalid IL or missing references) //IL_1a63: Unknown result type (might be due to invalid IL or missing references) //IL_1a67: Unknown result type (might be due to invalid IL or missing references) //IL_1a69: Invalid comparison between Unknown and I4 //IL_16de: Unknown result type (might be due to invalid IL or missing references) //IL_16e3: Unknown result type (might be due to invalid IL or missing references) //IL_1ae2: Unknown result type (might be due to invalid IL or missing references) //IL_1ae5: Unknown result type (might be due to invalid IL or missing references) //IL_1ae7: Invalid comparison between Unknown and I4 //IL_1aeb: Unknown result type (might be due to invalid IL or missing references) //IL_1aef: Invalid comparison between Unknown and I4 //IL_1af3: Unknown result type (might be due to invalid IL or missing references) //IL_1af7: Invalid comparison between Unknown and I4 //IL_1f88: Unknown result type (might be due to invalid IL or missing references) //IL_1f8b: Invalid comparison between Unknown and I4 Type type = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager"); if (DefaultConfigurability != Configurability.Disabled) { bool saveOnConfigSet = plugin.Config.SaveOnConfigSet; plugin.Config.SaveOnConfigSet = false; foreach (Item item3 in registeredItems.Where((Item i) => i.configurability != Configurability.Disabled)) { Item item = item3; string name = item.Prefab.GetComponent().m_itemData.m_shared.m_name; string englishName = new Regex("[=\\n\\t\\\\\"\\'\\[\\]]*").Replace(english.Localize(name), "").Trim(); string localizedName = Localization.instance.Localize(name).Trim(); int order = 0; if ((item.configurability & Configurability.Recipe) != Configurability.Disabled) { itemCraftConfigs[item] = new Dictionary(); foreach (string item4 in item.Recipes.Keys.DefaultIfEmpty("")) { string configKey = item4; string text = ((configKey == "") ? "" : (" (" + configKey + ")")); if (!item.Recipes.ContainsKey(configKey) || item.Recipes[configKey].Crafting.Stations.Count <= 0) { continue; } ItemConfig itemConfig = (itemCraftConfigs[item][configKey] = new ItemConfig()); ItemConfig cfg = itemConfig; List hideWhenNoneAttributes = new List(); cfg.table = config(englishName, "Crafting Station" + text, item.Recipes[configKey].Crafting.Stations.First().Table, new ConfigDescription("Crafting station where " + englishName + " is available.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Browsable = ((item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName } })); ConfigurationManagerAttributes customTableAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = CustomTableBrowsability, Browsable = (CustomTableBrowsability() && (item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; cfg.customTable = config(englishName, "Custom Crafting Station" + text, item.Recipes[configKey].Crafting.Stations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.table.SettingChanged += TableConfigChanged; cfg.customTable.SettingChanged += TableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = TableLevelBrowsability, Browsable = (TableLevelBrowsability() && (item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; hideWhenNoneAttributes.Add(configurationManagerAttributes); cfg.tableLevel = config(englishName, "Crafting Station Level" + text, item.Recipes[configKey].Crafting.Stations.First().level, new ConfigDescription("Required crafting station level to craft " + englishName + ".", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); cfg.tableLevel.SettingChanged += delegate { if (activeRecipes.ContainsKey(item) && activeRecipes[item].TryGetValue(configKey, out List value)) { value.First().m_minStationLevel = cfg.tableLevel.Value; } }; if (item.Prefab.GetComponent().m_itemData.m_shared.m_maxQuality > 1) { cfg.maximumTableLevel = config(englishName, "Maximum Crafting Station Level" + text, (item.MaximumRequiredStationLevel == int.MaxValue) ? (item.Recipes[configKey].Crafting.Stations.First().level + item.Prefab.GetComponent().m_itemData.m_shared.m_maxQuality - 1) : item.MaximumRequiredStationLevel, new ConfigDescription("Maximum crafting station level to upgrade and repair " + englishName + ".", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); } cfg.requireOneIngredient = config(englishName, "Require only one resource" + text, item.Recipes[configKey].RequireOnlyOneIngredient ? Toggle.On : Toggle.Off, new ConfigDescription("Whether only one of the ingredients is needed to craft " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Category = localizedName } })); ConfigurationManagerAttributes qualityResultAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = QualityResultBrowsability, Browsable = (QualityResultBrowsability() && (item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; cfg.requireOneIngredient.SettingChanged += delegate { if (activeRecipes.ContainsKey(item) && activeRecipes[item].TryGetValue(configKey, out List value)) { foreach (Recipe item5 in value) { item5.m_requireOnlyOneIngredient = cfg.requireOneIngredient.Value == Toggle.On; } } qualityResultAttributes.Browsable = QualityResultBrowsability(); reloadConfigDisplay(); }; cfg.qualityResultAmountMultiplier = config(englishName, "Quality Multiplier" + text, item.Recipes[configKey].QualityResultAmountMultiplier, new ConfigDescription("Multiplies the crafted amount based on the quality of the resources when crafting " + englishName + ". Only works, if Require Only One Resource is true.", (AcceptableValueBase)null, new object[1] { qualityResultAttributes })); cfg.qualityResultAmountMultiplier.SettingChanged += delegate { if (activeRecipes.ContainsKey(item) && activeRecipes[item].TryGetValue(configKey, out List value)) { foreach (Recipe item6 in value) { item6.m_qualityResultAmountMultiplier = cfg.qualityResultAmountMultiplier.Value; } } }; if ((!item.Recipes[configKey].RequiredItems.Free || item.Recipes[configKey].RequiredItems.Requirements.Count > 0) && item.Recipes[configKey].RequiredItems.Requirements.All((Requirement r) => r.amountConfig == null)) { cfg.craft = itemConfig3("Crafting Costs" + text, new SerializedRequirements(item.Recipes[configKey].RequiredItems.Requirements).ToString(), "Item costs to craft " + englishName, isUpgrade: false); } if (item.Prefab.GetComponent().m_itemData.m_shared.m_maxQuality > 1 && (!item.Recipes[configKey].RequiredUpgradeItems.Free || item.Recipes[configKey].RequiredUpgradeItems.Requirements.Count > 0) && item.Recipes[configKey].RequiredUpgradeItems.Requirements.All((Requirement r) => r.amountConfig == null)) { cfg.upgrade = itemConfig3("Upgrading Costs" + text, new SerializedRequirements(item.Recipes[configKey].RequiredUpgradeItems.Requirements).ToString(), "Item costs per level to upgrade " + englishName, isUpgrade: true); } if (cfg.craft != null) { cfg.craft.SettingChanged += ConfigChanged; } if (cfg.upgrade != null) { cfg.upgrade.SettingChanged += ConfigChanged; } void ConfigChanged(object o, EventArgs e) { item.UpdateCraftConfig(configKey, new SerializedRequirements(cfg.craft?.Value ?? ""), new SerializedRequirements(cfg.upgrade?.Value ?? "")); } bool CustomTableBrowsability() { return cfg.table.Value == CraftingTable.Custom; } bool ItemBrowsability() { return cfg.table.Value != CraftingTable.Disabled; } bool QualityResultBrowsability() { return cfg.requireOneIngredient.Value == Toggle.On; } void TableConfigChanged(object o, EventArgs e) { item.UpdateItemTableConfig(configKey, cfg.table.Value, cfg.customTable.Value); customTableAttributes.Browsable = cfg.table.Value == CraftingTable.Custom; foreach (ConfigurationManagerAttributes item7 in hideWhenNoneAttributes) { item7.Browsable = cfg.table.Value != CraftingTable.Disabled; } reloadConfigDisplay(); } bool TableLevelBrowsability() { return cfg.table.Value != CraftingTable.Disabled; } ConfigEntry itemConfig3(string name2, string value, string desc, bool isUpgrade) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes { CustomDrawer = drawRequirementsConfigTable(item, isUpgrade), Order = (order -= 1), browsability = ItemBrowsability, Browsable = (ItemBrowsability() && (item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; hideWhenNoneAttributes.Add(configurationManagerAttributes2); return config(englishName, name2, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes2 })); } } if ((item.configurability & Configurability.Drop) != Configurability.Disabled) { ConfigEntry val = (itemDropConfigs[item] = config(englishName, "Drops from", new SerializedDrop(item.DropsFrom.Drops).ToString(), new ConfigDescription(englishName + " drops from this creature.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { CustomDrawer = drawDropsConfigTable, Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Drop) != 0) } }))); ConfigEntry val3 = val; val3.SettingChanged += delegate { item.UpdateCharacterDrop(); }; } for (int num = 0; num < item.Conversions.Count; num++) { string text2 = ((item.Conversions.Count > 1) ? $"{num + 1}. " : ""); Conversion conversion = item.Conversions[num]; conversion.config = new Conversion.ConversionConfig(); int index = num; conversion.config.input = config(englishName, text2 + "Conversion Input Item", conversion.Input, new ConfigDescription("Input item to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.input.SettingChanged += delegate { if (index < item.conversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) { ItemDrop val4 = SerializedRequirements.fetchByName(instance, conversion.config.input.Value); item.conversions[index].m_from = val4; UpdatePiece(); } } }; conversion.config.piece = config(englishName, text2 + "Conversion Piece", conversion.Piece, new ConfigDescription("Conversion piece used to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.piece.SettingChanged += delegate { UpdatePiece(); }; conversion.config.customPiece = config(englishName, text2 + "Conversion Custom Piece", conversion.customPiece ?? "", new ConfigDescription("Custom conversion piece to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.customPiece.SettingChanged += delegate { UpdatePiece(); }; void UpdatePiece() { if (index < item.conversions.Count && Object.op_Implicit((Object)(object)ZNetScene.instance)) { string text3 = ((conversion.config.piece.Value == ConversionPiece.Disabled) ? null : ((conversion.config.piece.Value == ConversionPiece.Custom) ? conversion.config.customPiece.Value : getInternalName(conversion.config.piece.Value))); string activePiece = conversion.config.activePiece; if (conversion.config.activePiece != null) { Smelter component = ZNetScene.instance.GetPrefab(conversion.config.activePiece).GetComponent(); int num4 = component.m_conversion.IndexOf(item.conversions[index]); if (num4 >= 0) { Smelter[] array3 = Resources.FindObjectsOfTypeAll(); foreach (Smelter val4 in array3) { if (Utils.GetPrefabName(((Component)val4).gameObject) == activePiece) { val4.m_conversion.RemoveAt(num4); } } } conversion.config.activePiece = null; } if (item.conversions[index].m_from != null && conversion.config.piece.Value != ConversionPiece.Disabled) { GameObject prefab = ZNetScene.instance.GetPrefab(text3); if (((prefab != null) ? prefab.GetComponent() : null) != null) { conversion.config.activePiece = text3; Smelter[] array4 = Resources.FindObjectsOfTypeAll(); foreach (Smelter val5 in array4) { if (Utils.GetPrefabName(((Component)val5).gameObject) == text3) { val5.m_conversion.Add(item.conversions[index]); } } } } } } } } if ((item.configurability & Configurability.Stats) != Configurability.Disabled) { item.statsConfigs.Clear(); SharedData shared = item.Prefab.GetComponent().m_itemData.m_shared; ItemType itemType = shared.m_itemType; statcfg("Weight", "Weight of " + englishName + ".", (SharedData val4) => val4.m_weight, delegate(SharedData val4, float value) { val4.m_weight = value; }); statcfg("Trader Value", "Trader value of " + englishName + ".", (SharedData val4) => val4.m_value, delegate(SharedData val4, int value) { val4.m_value = value; }); bool flag; switch (itemType - 3) { case 0: case 1: case 2: case 3: case 4: case 8: case 9: case 11: case 14: case 16: case 19: flag = true; break; default: flag = false; break; } if (flag) { statcfg("Durability", "Durability of " + englishName + ".", (SharedData val4) => val4.m_maxDurability, delegate(SharedData val4, float value) { val4.m_maxDurability = value; }); statcfg("Durability per Level", "Durability gain per level of " + englishName + ".", (SharedData val4) => val4.m_durabilityPerLevel, delegate(SharedData val4, float value) { val4.m_durabilityPerLevel = value; }); statcfg("Movement Speed Modifier", "Movement speed modifier of " + englishName + ".", (SharedData val4) => val4.m_movementModifier, delegate(SharedData val4, float value) { val4.m_movementModifier = value; }); } if ((itemType - 3 <= 2 || (int)itemType == 14 || (int)itemType == 22) ? true : false) { statcfg("Block Armor", "Block armor of " + englishName + ".", (SharedData val4) => val4.m_blockPower, delegate(SharedData val4, float value) { val4.m_blockPower = value; }); statcfg("Block Armor per Level", "Block armor per level for " + englishName + ".", (SharedData val4) => val4.m_blockPowerPerLevel, delegate(SharedData val4, float value) { val4.m_blockPowerPerLevel = value; }); statcfg("Block Force", "Block force of " + englishName + ".", (SharedData val4) => val4.m_deflectionForce, delegate(SharedData val4, float value) { val4.m_deflectionForce = value; }); statcfg("Block Force per Level", "Block force per level for " + englishName + ".", (SharedData val4) => val4.m_deflectionForcePerLevel, delegate(SharedData val4, float value) { val4.m_deflectionForcePerLevel = value; }); statcfg("Parry Bonus", "Parry bonus of " + englishName + ".", (SharedData val4) => val4.m_timedBlockBonus, delegate(SharedData val4, float value) { val4.m_timedBlockBonus = value; }); } else if ((itemType - 6 <= 1 || itemType - 11 <= 1 || (int)itemType == 17) ? true : false) { statcfg("Armor", "Armor of " + englishName + ".", (SharedData val4) => val4.m_armor, delegate(SharedData val4, float value) { val4.m_armor = value; }); statcfg("Armor per Level", "Armor per level for " + englishName + ".", (SharedData val4) => val4.m_armorPerLevel, delegate(SharedData val4, float value) { val4.m_armorPerLevel = value; }); } SkillType skillType = shared.m_skillType; if (((int)skillType == 7 || (int)skillType == 12) ? true : false) { statcfg("Tool tier", "Tool tier of " + englishName + ".", (SharedData val4) => val4.m_toolTier, delegate(SharedData val4, int value) { val4.m_toolTier = value; }); } if ((itemType - 5 <= 2 || itemType - 11 <= 1 || (int)itemType == 17) ? true : false) { Dictionary modifiers = shared.m_damageModifiers.ToDictionary((DamageModPair d) => d.m_type, (DamageModPair d) => (DamageModifier)d.m_modifier); DamageType[] first = (DamageType[])Enum.GetValues(typeof(DamageType)); DamageType[] array = new DamageType[5]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); foreach (DamageType damageType in first.Except((IEnumerable)(object)array)) { statcfg(((object)Unsafe.As(ref damageType)/*cast due to .constrained prefix*/).ToString() + " Resistance", ((object)Unsafe.As(ref damageType)/*cast due to .constrained prefix*/).ToString() + " resistance of " + englishName + ".", (SharedData _) => modifiers.TryGetValue(damageType, out var value) ? value : DamageModifier.None, delegate(SharedData val5, DamageModifier value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //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_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) DamageModPair val4 = new DamageModPair { m_type = damageType, m_modifier = (DamageModifier)value }; for (int i = 0; i < val5.m_damageModifiers.Count; i++) { if (val5.m_damageModifiers[i].m_type == damageType) { if (value == DamageModifier.None) { val5.m_damageModifiers.RemoveAt(i); } else { val5.m_damageModifiers[i] = val4; } return; } } if (value != DamageModifier.None) { val5.m_damageModifiers.Add(val4); } }); } } if ((int)itemType == 2 && shared.m_food > 0f) { statcfg("Health", "Health value of " + englishName + ".", (SharedData val4) => val4.m_food, delegate(SharedData val4, float value) { val4.m_food = value; }); statcfg("Stamina", "Stamina value of " + englishName + ".", (SharedData val4) => val4.m_foodStamina, delegate(SharedData val4, float value) { val4.m_foodStamina = value; }); statcfg("Eitr", "Eitr value of " + englishName + ".", (SharedData val4) => val4.m_foodEitr, delegate(SharedData val4, float value) { val4.m_foodEitr = value; }); statcfg("Duration", "Duration of " + englishName + ".", (SharedData val4) => val4.m_foodBurnTime, delegate(SharedData val4, float value) { val4.m_foodBurnTime = value; }); statcfg("Health Regen", "Health regen value of " + englishName + ".", (SharedData val4) => val4.m_foodRegen, delegate(SharedData val4, float value) { val4.m_foodRegen = value; }); } if ((int)shared.m_skillType == 10) { statcfg("Health Cost", "Health cost of " + englishName + ".", (SharedData val4) => val4.m_attack.m_attackHealth, delegate(SharedData val4, float value) { val4.m_attack.m_attackHealth = value; }); statcfg("Health Cost Percentage", "Health cost percentage of " + englishName + ".", (SharedData val4) => val4.m_attack.m_attackHealthPercentage, delegate(SharedData val4, float value) { val4.m_attack.m_attackHealthPercentage = value; }); } skillType = shared.m_skillType; if (skillType - 9 <= 1) { statcfg("Eitr Cost", "Eitr cost of " + englishName + ".", (SharedData val4) => val4.m_attack.m_attackEitr, delegate(SharedData val4, float value) { val4.m_attack.m_attackEitr = value; }); } if ((itemType - 3 <= 1 || (int)itemType == 14 || (int)itemType == 22) ? true : false) { statcfg("Knockback", "Knockback of " + englishName + ".", (SharedData val4) => val4.m_attackForce, delegate(SharedData val4, float value) { val4.m_attackForce = value; }); statcfg("Backstab Bonus", "Backstab bonus of " + englishName + ".", (SharedData val4) => val4.m_backstabBonus, delegate(SharedData val4, float value) { val4.m_backstabBonus = value; }); statcfg("Attack Stamina", "Attack stamina of " + englishName + ".", (SharedData val4) => val4.m_attack.m_attackStamina, delegate(SharedData val4, float value) { val4.m_attack.m_attackStamina = value; }); SetDmg("True", (DamageTypes dmg) => dmg.m_damage, delegate(ref DamageTypes dmg, float damage) { dmg.m_damage = damage; }); SetDmg("Slash", (DamageTypes dmg) => dmg.m_slash, delegate(ref DamageTypes dmg, float slash) { dmg.m_slash = slash; }); SetDmg("Pierce", (DamageTypes dmg) => dmg.m_pierce, delegate(ref DamageTypes dmg, float pierce) { dmg.m_pierce = pierce; }); SetDmg("Blunt", (DamageTypes dmg) => dmg.m_blunt, delegate(ref DamageTypes dmg, float blunt) { dmg.m_blunt = blunt; }); SetDmg("Chop", (DamageTypes dmg) => dmg.m_chop, delegate(ref DamageTypes dmg, float chop) { dmg.m_chop = chop; }); SetDmg("Pickaxe", (DamageTypes dmg) => dmg.m_pickaxe, delegate(ref DamageTypes dmg, float pickaxe) { dmg.m_pickaxe = pickaxe; }); SetDmg("Fire", (DamageTypes dmg) => dmg.m_fire, delegate(ref DamageTypes dmg, float fire) { dmg.m_fire = fire; }); SetDmg("Poison", (DamageTypes dmg) => dmg.m_poison, delegate(ref DamageTypes dmg, float poison) { dmg.m_poison = poison; }); SetDmg("Frost", (DamageTypes dmg) => dmg.m_frost, delegate(ref DamageTypes dmg, float frost) { dmg.m_frost = frost; }); SetDmg("Lightning", (DamageTypes dmg) => dmg.m_lightning, delegate(ref DamageTypes dmg, float lightning) { dmg.m_lightning = lightning; }); SetDmg("Spirit", (DamageTypes dmg) => dmg.m_spirit, delegate(ref DamageTypes dmg, float spirit) { dmg.m_spirit = spirit; }); if ((int)itemType == 4) { statcfg("Projectiles", "Number of projectiles that " + englishName + " shoots at once.", (SharedData val4) => val4.m_attack.m_projectileBursts, delegate(SharedData val4, int value) { val4.m_attack.m_projectileBursts = value; }); statcfg("Burst Interval", "Time between the projectiles " + englishName + " shoots at once.", (SharedData val4) => val4.m_attack.m_burstInterval, delegate(SharedData val4, float value) { val4.m_attack.m_burstInterval = value; }); statcfg("Minimum Accuracy", "Minimum accuracy for " + englishName + ".", (SharedData val4) => val4.m_attack.m_projectileAccuracyMin, delegate(SharedData val4, float value) { val4.m_attack.m_projectileAccuracyMin = value; }); statcfg("Accuracy", "Accuracy for " + englishName + ".", (SharedData val4) => val4.m_attack.m_projectileAccuracy, delegate(SharedData val4, float value) { val4.m_attack.m_projectileAccuracy = value; }); statcfg("Minimum Velocity", "Minimum velocity for " + englishName + ".", (SharedData val4) => val4.m_attack.m_projectileVelMin, delegate(SharedData val4, float value) { val4.m_attack.m_projectileVelMin = value; }); statcfg("Velocity", "Velocity for " + englishName + ".", (SharedData val4) => val4.m_attack.m_projectileVel, delegate(SharedData val4, float value) { val4.m_attack.m_projectileVel = value; }); statcfg("Maximum Draw Time", "Time until " + englishName + " is fully drawn at skill level 0.", (SharedData val4) => val4.m_attack.m_drawDurationMin, delegate(SharedData val4, float value) { val4.m_attack.m_drawDurationMin = value; }); statcfg("Stamina Drain", "Stamina drain per second while drawing " + englishName + ".", (SharedData val4) => val4.m_attack.m_drawStaminaDrain, delegate(SharedData val4, float value) { val4.m_attack.m_drawStaminaDrain = value; }); } } } List traderAttributes; if ((item.configurability & Configurability.Trader) != Configurability.Disabled) { traderAttributes = new List(); item.traderConfig = new TraderConfig { trader = config(englishName, "Trader Selling", item.Trade.Trader, new ConfigDescription("Which traders sell " + englishName + ".", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Browsable = ((item.configurationVisible & Configurability.Trader) != 0), Category = localizedName } })) }; item.traderConfig.trader.SettingChanged += delegate { item.ReloadTraderConfiguration(); foreach (ConfigurationManagerAttributes item8 in traderAttributes) { item8.Browsable = TraderBrowsability(); } reloadConfigDisplay(); }; item.traderConfig.price = traderConfig("Trader Price", item.Trade.Price, "Price of " + englishName + " at the trader."); item.traderConfig.stack = traderConfig("Trader Stack", item.Trade.Stack, "Stack size of " + englishName + " in the trader. Also known as the number of items sold by a trader in one transaction."); item.traderConfig.requiredGlobalKey = traderConfig("Trader Required Global Key", item.Trade.RequiredGlobalKey ?? "", "Required global key to unlock " + englishName + " at the trader."); if (item.traderConfig.trader.Value != Trader.None) { PrefabManager.AddItemToTrader(item.Prefab, item.traderConfig.trader.Value, item.traderConfig.price.Value, item.traderConfig.stack.Value, item.traderConfig.requiredGlobalKey.Value); } } else if (item.Trade.Trader != Trader.None) { PrefabManager.AddItemToTrader(item.Prefab, item.Trade.Trader, item.Trade.Price, item.Trade.Stack, item.Trade.RequiredGlobalKey); } void SetDmg(string dmgType, Func readDmg, setDmgFunc setDmg) { statcfg(dmgType + " Damage", dmgType + " damage dealt by " + englishName + ".", (SharedData val4) => readDmg(val4.m_damages), delegate(SharedData val4, float value) { setDmg(ref val4.m_damages, value); }); statcfg(dmgType + " Damage Per Level", dmgType + " damage dealt increase per level for " + englishName + ".", (SharedData val4) => readDmg(val4.m_damagesPerLevel), delegate(SharedData val4, float value) { setDmg(ref val4.m_damagesPerLevel, value); }); } bool TraderBrowsability() { return item.traderConfig.trader.Value != Trader.None; } void statcfg(string configName, string description, Func readDefault, Action setValue) where T : notnull { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown SharedData shared2 = item.Prefab.GetComponent().m_itemData.m_shared; ConfigEntry cfg2 = config(englishName, configName, readDefault(shared2), new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Stats) != 0) } })); if ((item.configurationVisible & Configurability.Stats) != Configurability.Disabled) { setValue(shared2, cfg2.Value); } item.statsConfigs.Add((ConfigEntryBase)(object)cfg2, ApplyConfig); cfg2.SettingChanged += delegate { if ((item.configurationVisible & Configurability.Stats) != Configurability.Disabled) { ApplyConfig(); } }; void ApplyConfig() { item.ApplyToAllInstances(delegate(ItemData val4) { setValue(val4.m_shared, cfg2.Value); }); } } ConfigEntry traderConfig(string name2, T value, string desc) where T : notnull { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = TraderBrowsability, Browsable = (TraderBrowsability() && (item.configurationVisible & Configurability.Trader) != 0), Category = localizedName }; traderAttributes.Add(configurationManagerAttributes2); ConfigEntry val4 = config(englishName, name2, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes2 })); val4.SettingChanged += delegate { item.ReloadTraderConfiguration(); }; return val4; } } if (saveOnConfigSet) { plugin.Config.SaveOnConfigSet = true; plugin.Config.Save(); } } configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type)); foreach (Item registeredItem in registeredItems) { Item item2 = registeredItem; foreach (KeyValuePair recipe in item2.Recipes) { KeyValuePair kv = recipe; RequiredResourceList[] array2 = new RequiredResourceList[2] { kv.Value.RequiredItems, kv.Value.RequiredUpgradeItems }; foreach (RequiredResourceList requiredResourceList in array2) { for (int num3 = 0; num3 < requiredResourceList.Requirements.Count; num3++) { ConfigEntry amountCfg; int resourceIndex; if ((item2.configurability & Configurability.Recipe) != Configurability.Disabled) { amountCfg = requiredResourceList.Requirements[num3].amountConfig; if (amountCfg != null) { resourceIndex = num3; amountCfg.SettingChanged += ConfigChanged2; } } void ConfigChanged2(object o, EventArgs e) { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && activeRecipes.ContainsKey(item2) && activeRecipes[item2].TryGetValue(kv.Key, out List value)) { foreach (Recipe item9 in value) { item9.m_resources[resourceIndex].m_amount = amountCfg.Value; } } } } } } item2.InitializeNewRegisteredItem(); } } private void InitializeNewRegisteredItem() { foreach (KeyValuePair recipe in Recipes) { KeyValuePair kv = recipe; ConfigEntryBase enabledCfg = kv.Value.RecipeIsActive; if (enabledCfg != null) { ((object)enabledCfg).GetType().GetEvent("SettingChanged").AddEventHandler(enabledCfg, new EventHandler(ConfigChanged)); } void ConfigChanged(object o, EventArgs e) { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && activeRecipes.ContainsKey(this) && activeRecipes[this].TryGetValue(kv.Key, out List value)) { foreach (Recipe item in value) { item.m_enabled = (int)enabledCfg.BoxedValue != 0; } } } } } public void ReloadCraftingConfiguration() { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && ObjectDB.instance.GetItemPrefab(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name)) == null) { registerRecipesInObjectDB(ObjectDB.instance); ObjectDB.instance.m_items.Add(Prefab); ObjectDB.instance.m_itemByHash.Add(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name), Prefab); ZNetScene.instance.m_prefabs.Add(Prefab); ZNetScene.instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name), Prefab); } foreach (string item in Recipes.Keys.DefaultIfEmpty("")) { if (Recipes.TryGetValue(item, out ItemRecipe value) && value.Crafting.Stations.Count > 0) { UpdateItemTableConfig(item, value.Crafting.Stations.First().Table, value.Crafting.Stations.First().custom ?? ""); UpdateCraftConfig(item, new SerializedRequirements(value.RequiredItems.Requirements), new SerializedRequirements(value.RequiredUpgradeItems.Requirements)); } } } private void ReloadTraderConfiguration() { if (traderConfig.trader.Value == Trader.None) { PrefabManager.RemoveItemFromTrader(Prefab); } else { PrefabManager.AddItemToTrader(Prefab, traderConfig.trader.Value, traderConfig.price.Value, traderConfig.stack.Value, traderConfig.requiredGlobalKey.Value); } } public static void ApplyToAllInstances(GameObject prefab, Action callback) { callback(prefab.GetComponent().m_itemData); string name = prefab.GetComponent().m_itemData.m_shared.m_name; Inventory[] source = (from c in Player.s_players.Select((Player p) => ((Humanoid)p).GetInventory()).Concat(from c in Object.FindObjectsOfType() select c.GetInventory()) where c != null select c).ToArray(); foreach (ItemData item in (from i in (from p in ObjectDB.instance.m_items select p.GetComponent() into c where Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((Component)c).GetComponent()) select c).Concat(ItemDrop.s_instances) select i.m_itemData).Concat(source.SelectMany((Inventory i) => i.GetAllItems()))) { if (item.m_shared.m_name == name) { callback(item); } } } public void ApplyToAllInstances(Action callback) { ApplyToAllInstances(Prefab, callback); } private static string getInternalName(T value) where T : struct { return ((InternalName)typeof(T).GetMember(value.ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName; } private void registerRecipesInObjectDB(ObjectDB objectDB) { //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Expected O, but got Unknown activeRecipes[this] = new Dictionary>(); itemCraftConfigs.TryGetValue(this, out Dictionary value); foreach (KeyValuePair recipe in Recipes) { List list = new List(); foreach (CraftingStationConfig station in recipe.Value.Crafting.Stations) { ItemConfig itemConfig = null; if (value != null && value.TryGetValue(recipe.Key, out var value2)) { itemConfig = value2; } CraftingTable craftingTable = ((itemConfig == null || list.Count > 0) ? station.Table : itemConfig.table.Value); string text = ((itemConfig == null || list.Count > 0) ? station.custom : itemConfig.customTable.Value); Recipe val = ScriptableObject.CreateInstance(); string name = ((Object)Prefab).name; CraftingTable table = station.Table; ((Object)val).name = name + "_Recipe_" + table; val.m_amount = recipe.Value.CraftAmount; bool enabled; if (itemConfig != null) { enabled = itemConfig.table.Value != CraftingTable.Disabled; } else { ConfigEntryBase? recipeIsActive = recipe.Value.RecipeIsActive; enabled = (int)(((recipeIsActive != null) ? recipeIsActive.BoxedValue : null) ?? ((object)1)) != 0; } val.m_enabled = enabled; val.m_item = Prefab.GetComponent(); val.m_resources = SerializedRequirements.toPieceReqs(objectDB, (itemConfig?.craft == null) ? new SerializedRequirements(recipe.Value.RequiredItems.Requirements) : new SerializedRequirements(itemConfig.craft.Value), (itemConfig?.upgrade == null) ? new SerializedRequirements(recipe.Value.RequiredUpgradeItems.Requirements) : new SerializedRequirements(itemConfig.upgrade.Value)); if ((uint)craftingTable <= 1u) { val.m_craftingStation = null; } else { string text2 = ((craftingTable == CraftingTable.Custom) ? text : getInternalName(craftingTable)); ZNetScene instance = ZNetScene.instance; GameObject val2 = (Object.op_Implicit((Object)(object)instance) ? instance.GetPrefab(text2) : null); if (Object.op_Implicit((Object)(object)val2)) { CraftingStation component = val2.GetComponent(); if (component != null) { val.m_craftingStation = component; goto IL_02c9; } } val.m_craftingStation = null; val.m_enabled = false; Debug.LogWarning((object)("Crafting station '" + text2 + "' does not exist; disabling recipe '" + ((Object)val).name + "'.")); } goto IL_02c9; IL_02c9: val.m_minStationLevel = ((itemConfig == null || list.Count > 0) ? station.level : itemConfig.tableLevel.Value); val.m_requireOnlyOneIngredient = ((itemConfig == null) ? recipe.Value.RequireOnlyOneIngredient : (itemConfig.requireOneIngredient.Value == Toggle.On)); val.m_qualityResultAmountMultiplier = itemConfig?.qualityResultAmountMultiplier.Value ?? recipe.Value.QualityResultAmountMultiplier; list.Add(val); RequiredResourceList requiredItems = recipe.Value.RequiredItems; if (requiredItems != null && !requiredItems.Free) { List requirements = requiredItems.Requirements; if (requirements != null && requirements.Count == 0) { hiddenCraftRecipes.Add(val, recipe.Value.RecipeIsActive); } } requiredItems = recipe.Value.RequiredUpgradeItems; if (requiredItems != null && !requiredItems.Free) { List requirements = requiredItems.Requirements; if (requirements != null && requirements.Count == 0) { hiddenUpgradeRecipes.Add(val, recipe.Value.RecipeIsActive); } } } activeRecipes[this].Add(recipe.Key, list); objectDB.m_recipes.AddRange(list); } conversions = new List(); for (int i = 0; i < Conversions.Count; i++) { Conversion conversion = Conversions[i]; conversions.Add(new ItemConversion { m_from = SerializedRequirements.fetchByName(ObjectDB.instance, conversion.config?.input.Value ?? conversion.Input), m_to = Prefab.GetComponent() }); ConversionPiece conversionPiece = conversion.config?.piece.Value ?? conversion.Piece; string text3 = null; if (conversionPiece != ConversionPiece.Disabled && conversions[i].m_from != null) { text3 = ((conversionPiece != ConversionPiece.Custom) ? getInternalName(conversionPiece) : (conversion.config?.customPiece.Value ?? conversion.customPiece)); GameObject prefab = ZNetScene.instance.GetPrefab(text3); Smelter val3 = ((prefab != null) ? prefab.GetComponent() : null); if (val3 != null) { val3.m_conversion.Add(conversions[i]); } else { text3 = null; } } if (conversion.config != null) { conversion.config.activePiece = text3; } } } [HarmonyPriority(0)] internal static void Patch_ObjectDBInit(ObjectDB __instance) { if ((Object)(object)__instance.GetItemPrefab("YagluthDrop") == (Object)null) { return; } hiddenCraftRecipes.Clear(); hiddenUpgradeRecipes.Clear(); foreach (Item registeredItem in registeredItems) { registeredItem.registerRecipesInObjectDB(__instance); } } internal static void Patch_TraderGetAvailableItems(Trader __instance, ref List __result) { string prefabName = Utils.GetPrefabName(((Component)__instance).gameObject); if (1 == 0) { } Trader trader = ((prefabName == "Haldor") ? Trader.Haldor : ((prefabName == "Hildir") ? Trader.Hildir : Trader.None)); if (1 == 0) { } Trader trader2 = trader; __result.AddRange(from tuple in PrefabManager.CustomTradeItems.Values where (tuple.Item1 & trader2) != 0 select tuple.Item2 into tradeItem where string.IsNullOrEmpty(tradeItem.m_requiredGlobalKey) || ZoneSystem.instance.GetGlobalKey(tradeItem.m_requiredGlobalKey) select tradeItem); } internal static void Patch_OnAddSmelterInput(ItemData item, bool __result) { if (__result) { ((Humanoid)Player.m_localPlayer).UnequipItem(item, true); } } internal static void Patch_MaximumRequiredStationLevel(Recipe __instance, ref int __result, int quality) { if (!itemDropMap.TryGetValue(__instance.m_item, out Item value)) { return; } IEnumerable source; if (!itemCraftConfigs.TryGetValue(value, out Dictionary value2)) { source = Enumerable.Empty(); } else { CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); if (currentCraftingStation != null) { string stationName = Utils.GetPrefabName(((Component)currentCraftingStation).gameObject); source = from c in value2.Where(delegate(KeyValuePair c) { CraftingTable value3 = c.Value.table.Value; if (1 == 0) { } bool result; switch (value3) { case CraftingTable.Disabled: case CraftingTable.Inventory: result = false; break; case CraftingTable.Custom: result = c.Value.customTable.Value == stationName; break; default: result = getInternalName(c.Value.table.Value) == stationName; break; } if (1 == 0) { } return result; }) select c.Value; } else { source = value2.Values; } } __result = Mathf.Min(Mathf.Max(1, __instance.m_minStationLevel) + (quality - 1), (from cfg in source where cfg.maximumTableLevel != null select cfg.maximumTableLevel.Value).DefaultIfEmpty(value.MaximumRequiredStationLevel).Max()); } internal static void Patch_GetAvailableRecipesPrefix(ref Dictionary>? __state) { if (__state == null) { __state = new Dictionary>(); } Dictionary dictionary; if (InventoryGui.instance.InCraftTab()) { dictionary = hiddenCraftRecipes; } else { if (!InventoryGui.instance.InUpradeTab()) { return; } dictionary = hiddenUpgradeRecipes; } foreach (Recipe key in dictionary.Keys) { key.m_enabled = false; } __state[Assembly.GetExecutingAssembly()] = dictionary; } internal static void Patch_GetAvailableRecipesFinalizer(Dictionary> __state) { if (!__state.TryGetValue(Assembly.GetExecutingAssembly(), out Dictionary value)) { return; } foreach (KeyValuePair item in value) { Recipe key = item.Key; ConfigEntryBase value2 = item.Value; key.m_enabled = (int)(((value2 != null) ? value2.BoxedValue : null) ?? ((object)1)) != 0; } } internal static IEnumerable Transpile_SetupRequirementList(IEnumerable instructionsEnumerable, ILGenerator ilg) { //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown List list = instructionsEnumerable.ToList(); MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(InventoryGui), "SetupRequirement", (Type[])null, (Type[])null); CodeInstruction val = null; CodeInstruction val2 = null; LocalBuilder localBuilder = ilg.DeclareLocal(typeof(int)); Dictionary dictionary = new Dictionary(); bool flag = false; int num = 0; int value = 0; Label? label = default(Label?); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], methodInfo)) { val = list[i + 2]; val2 = list[i + 5]; flag = true; } if (flag) { if (CodeInstructionExtensions.Branches(list[i], ref label) && dictionary.TryGetValue(label.Value, out value)) { num = i; break; } continue; } foreach (Label label4 in list[i].labels) { dictionary[label4] = i; } } if (list[value - 3].opcode == OpCodes.Dup) { return list; } Label label2 = ilg.DefineLabel(); Label label3 = ilg.DefineLabel(); list[num + 1].labels.Add(label2); list.InsertRange(num + 1, (IEnumerable)(object)new CodeInstruction[11] { new CodeInstruction(OpCodes.Ldloc, (object)localBuilder), new CodeInstruction(OpCodes.Brfalse, (object)label2), val.Clone(), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.DeclaredField(typeof(InventoryGui), "m_recipeRequirementList")), new CodeInstruction(OpCodes.Ldlen, (object)null), new CodeInstruction(OpCodes.Bgt, (object)label2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), val2.Clone(), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Br, (object)label3) }); list.InsertRange(value - 2, (IEnumerable)(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Dup, (object)null) { labels = new List