Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SwordFirebrand v1.0.0
SwordFirebrand.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("SwordFirebrand")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Firebrand versions of the vanilla swords with Dyrnwyn-style flames, fire damage, throw and recall, a leap, and fiery blasts.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Sword Firebrand")] [assembly: AssemblyTitle("SwordFirebrand")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 SwordFirebrand { internal sealed class GearGroup { public string Tag; public ConfigEntry<bool> EmberTexture; public ConfigEntry<float> EmberIntensity; public ConfigEntry<float> GlowIntensity; public ConfigEntry<float> EmberTiles; } [BepInPlugin("brett.swordfirebrand", "Sword Firebrand", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal struct Span { public bool Valid; public int Axis; public float Min; public float Max; public Vector3 Center; public Vector3 Size; public float Width { get { float num = 0f; for (int i = 0; i < 3; i++) { if (i != Axis && ((Vector3)(ref Size))[i] > num) { num = ((Vector3)(ref Size))[i]; } } return num; } } } internal static GearGroup ArmorSettings; internal static GearGroup CapeSettings; internal static ConfigEntry<bool> BurnEnemies; internal static ConfigEntry<float> BurnSeconds; internal static ConfigEntry<float> BurnLight; internal static ConfigEntry<float> BurnFlameSize; internal static ConfigEntry<bool> BurnSwordFlames; internal static ConfigEntry<bool> CloneModdedItems; internal static ConfigEntry<bool> CloneRequireRecipe; internal static ConfigEntry<string> CloneExclude; internal static ConfigEntry<bool> SwordsCloneAll; internal static ConfigEntry<string> SwordsExtra; private static Dictionary<string, GameObject> itemIndex; private static Dictionary<string, Recipe> recipeIndex; private static bool itemSourcesLogged; internal static readonly Dictionary<string, string> AutoBases = new Dictionary<string, string>(); private static bool stationsFixLogged; private static Type localizationType; private static PropertyInfo localizationInstanceProp; private static FieldInfo localizationInstanceField; private static MethodInfo localizeMethod; private static bool localizationLooked; internal static ConfigEntry<bool> GearWithSword; internal static ConfigEntry<bool> GearFlare; internal static ConfigEntry<bool> SkinEmbers; internal static ConfigEntry<float> SkinEmberIntensity; internal static ConfigEntry<float> SkinGlowIntensity; internal static ConfigEntry<float> SkinEmberTiles; internal static ConfigEntry<bool> SkinSparks; private static float shieldTarget = -1f; private static readonly Dictionary<string, float> shieldFactors = new Dictionary<string, float>(); internal static ConfigEntry<bool> LeapEnabled; internal static ConfigEntry<float> LeapHeight; internal static ConfigEntry<float> LeapForward; internal static ConfigEntry<float> LeapStamina; internal static ConfigEntry<float> LeapCooldown; internal static ConfigEntry<bool> LeapLanding; internal static ConfigEntry<bool> LeapTrailOn; internal static ConfigEntry<float> LeapTrailSize; internal static ConfigEntry<bool> LeapSmokeOn; internal static ConfigEntry<float> LeapLight; internal static ConfigEntry<bool> ShareMyEffects; internal static ConfigEntry<bool> ShowOthersEffects; public const string PluginGuid = "brett.swordfirebrand"; public const string PluginName = "Sword Firebrand"; public const string PluginVersion = "1.0.0"; internal static Plugin Instance; internal static float DyrnwynBladeStart = 0.27f; internal static ConfigEntry<float> FireRatio; internal static ConfigEntry<float> FlatFireBonus; internal static ConfigEntry<int> Cores; internal static ConfigEntry<int> Coal; internal static ConfigEntry<bool> CopyVisuals; internal static ConfigEntry<float> FlameScale; internal static ConfigEntry<float> LightMultiplier; internal static ConfigEntry<bool> GlowBlades; internal static ConfigEntry<float> GlowIntensity; internal static ConfigEntry<float> ParticleSizeMultiplier; internal static ConfigEntry<float> EmissionMultiplier; internal static ConfigEntry<string> ExcludeParticleNames; internal static ConfigEntry<string> ExcludeNodeNames; internal static ManualLogSource Log; internal static Material FlameMaterial; internal static ConfigEntry<bool> TrailEnabled; internal static ConfigEntry<float> TrailMinSpeed; internal static ConfigEntry<float> TrailSize; internal static ConfigEntry<float> TrailLifetime; internal static ConfigEntry<float> TrailDensity; internal static ConfigEntry<bool> ImpactEnabled; internal static ConfigEntry<int> ImpactParticles; internal static ConfigEntry<float> ImpactLight; internal static ConfigEntry<bool> ThrowEnabled; internal static ConfigEntry<KeyboardShortcut> ThrowKey; internal static ConfigEntry<KeyboardShortcut> RecallKey; internal static ConfigEntry<bool> ThrowKeyAlsoRecalls; internal static ConfigEntry<float> ThrowStamina; internal static ConfigEntry<float> ThrowSpeed; internal static ConfigEntry<float> ThrowRange; internal static ConfigEntry<float> ReturnSpeed; internal static ConfigEntry<float> ThrowDamageMultiplier; internal static ConfigEntry<float> SpinSpeed; internal static ConfigEntry<float> AutoRecallSeconds; internal static ConfigEntry<float> FlameSideOffset; internal static ConfigEntry<float> FlameLiftOffset; internal static ConfigEntry<float> FlameForwardOffset; internal static ConfigEntry<float> BladeTextureBlend; internal static ConfigEntry<bool> EmberTexture; internal static ConfigEntry<float> EmberIntensity; internal static ConfigEntry<bool> VerboseLog; internal static ConfigEntry<string> DyrnwynPrefab; internal static ConfigEntry<float> FlameSpread; internal static ConfigEntry<bool> ThrowAnimationEnabled; internal static ConfigEntry<string> ThrowAnimationName; internal static ConfigEntry<float> ThrowReleaseDelay; internal static ConfigEntry<string> RecallEmote; internal static ConfigEntry<float> RecallDelay; internal static ConfigEntry<bool> MaceSecondary; internal static ConfigEntry<string> MaceSecondarySource; internal static ConfigEntry<string> MaceSecondarySourceTwoHanded; internal static ConfigEntry<bool> MaceSecondaryTwoHanded; internal static ConfigEntry<bool> ExplosionEnabled; internal static ConfigEntry<bool> ExplosionOnSecondary; internal static ConfigEntry<bool> ExplosionOnThrow; internal static ConfigEntry<bool> MaceImpactOnThrow; internal static ConfigEntry<float> ExplosionRadius; internal static ConfigEntry<float> ExplosionDamageMultiplier; internal static ConfigEntry<float> ExplosionPush; internal static ConfigEntry<float> ExplosionLight; internal static ConfigEntry<float> ExplosionEffectLifetime; internal static ConfigEntry<bool> ExplosionUseBombEffects; internal static ConfigEntry<string> ExplosionBombSource; private static bool swordsLeftLogged; private SharedData lastSecondarySource; private string lastSecondaryName; internal static ConfigEntry<bool> SecondaryPriority; internal static ConfigEntry<bool> ShieldEmberTexture; internal static ConfigEntry<float> ShieldEmberIntensity; internal static ConfigEntry<float> ShieldGlowIntensity; internal static ConfigEntry<float> ShieldEmberTiles; internal static ConfigEntry<bool> ShieldResize; internal static ConfigEntry<float> ShieldSizeBetween; internal static ConfigEntry<float> ShieldBackOffset; internal static ConfigEntry<float> ShieldBackLift; internal static ConfigEntry<float> ShieldBackSide; internal static ConfigEntry<bool> ShieldFireOnBlock; internal static ConfigEntry<float> ShieldFireRatio; internal static ConfigEntry<float> ShieldFireMax; private const float RoundAspect = 0.85f; private void BindArmor() { ArmorSettings = new GearGroup { Tag = "Armor" }; ArmorSettings.EmberTexture = ((BaseUnityPlugin)this).Config.Bind<bool>("Armor", "EmberTexture", true, "Glowing ember cracks (the same pattern as on the swords) across the armor you wear while a Firebrand sword is held."); ArmorSettings.EmberIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Armor", "EmberIntensity", 0.6f, "How brightly the ember cracks glow on armor."); ArmorSettings.GlowIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Armor", "GlowIntensity", 0.1f, "A faint even heat under the cracks. 0 = none."); ArmorSettings.EmberTiles = ((BaseUnityPlugin)this).Config.Bind<float>("Armor", "EmberTiles", 4f, "How many crack strips fit across the armor's texture. Higher = finer, more repeated cracks."); CapeSettings = new GearGroup { Tag = "Capes" }; CapeSettings.EmberTexture = ((BaseUnityPlugin)this).Config.Bind<bool>("Capes", "EmberTexture", true, "Glowing ember cracks (the same pattern as on the swords) across the cape you wear while a Firebrand sword is held."); CapeSettings.EmberIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Capes", "EmberIntensity", 0.6f, "How brightly the ember cracks glow on capes."); CapeSettings.GlowIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Capes", "GlowIntensity", 0.1f, "A faint even heat under the cracks. 0 = none."); CapeSettings.EmberTiles = ((BaseUnityPlugin)this).Config.Bind<float>("Capes", "EmberTiles", 4f, "How many crack strips fit across the cape's texture. Higher = finer, more repeated cracks."); } private void BindBurn() { BurnEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("Fire", "BurnEnemies", true, "Enemies hit by a Firebrand sword's fire (a swing, a thrown sword, the blast) or burned by a shield's fire on block are visibly set alight. Only the look; it adds no damage."); BurnSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Fire", "BurnSeconds", 4f, "How long an enemy keeps burning after the last fire hit."); BurnLight = ((BaseUnityPlugin)this).Config.Bind<float>("Fire", "BurnLight", 0.6f, "Brightness of the flickering firelight on a burning enemy. 0 = no light (cheaper with many enemies)."); BurnFlameSize = ((BaseUnityPlugin)this).Config.Bind<float>("Fire", "BurnFlameSize", 1f, "Size of the flames on a burning enemy. 1 = sized to the creature; raise it for bigger flames, lower it for smaller ones."); BurnSwordFlames = ((BaseUnityPlugin)this).Config.Bind<bool>("Fire", "BurnUseSwordFlames", true, "Use the same flame particles as the swords (copied from Dyrnwyn) for burning enemies. Turn off to use a plain flame sprite instead."); } private void BindCloning() { CloneModdedItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Cloning", "CloneModdedItems", false, "Off (default): only the vanilla swords get Firebrand versions, plus anything named in Swords/ExtraSwords. On: also look for swords that other mods add and clone those too (needs Swords/CloneEverySword on as well). Takes effect on the next start of the game."); CloneRequireRecipe = ((BaseUnityPlugin)this).Config.Bind<bool>("Cloning", "RequireRecipe", false, "Only clone swords that already have a crafting recipe when this mod looks. Off by default, because mods add their recipes later and would look uncraftable. On = leaves out weapons only monsters carry."); CloneExclude = ((BaseUnityPlugin)this).Config.Bind<string>("Cloning", "ExcludeNames", "Cheat,Debug,Dyrnwyn,IronFire", "Comma separated name fragments; any sword whose prefab name contains one is never cloned (items already named Firebrand never are). Applies to the swords found automatically, not to the ones on the built-in list or in Swords/ExtraSwords."); SwordsCloneAll = ((BaseUnityPlugin)this).Config.Bind<bool>("Swords", "CloneEverySword", true, "Besides the built-in list of vanilla swords, clone every other one-handed and two-handed sword in the game, including ones other mods add. Takes effect on the next start of the game."); SwordsExtra = ((BaseUnityPlugin)this).Config.Bind<string>("Swords", "ExtraSwords", "", "Comma separated prefab names of more swords to clone (for example a weapon that doesn't use the sword skill). The log lists the swords that were left alone as [Swords]."); } internal static List<GameObject> AllItemPrefabs() { //IL_0165: 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_017c: Unknown result type (might be due to invalid IL or missing references) List<GameObject> list = new List<GameObject>(); HashSet<string> hashSet = new HashSet<string>(); int num = 0; int num2 = 0; int num3 = 0; if ((Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items != null) { foreach (GameObject item in ObjectDB.instance.m_items) { if ((Object)(object)item != (Object)null && hashSet.Add(((Object)item).name)) { list.Add(item); num++; } } } try { object value = Traverse.Create((object)ItemManager.Instance).Field("Items").GetValue(); object obj; if (!(value is IDictionary dictionary)) { obj = value as IEnumerable; } else { IEnumerable values = dictionary.Values; obj = values; } IEnumerable enumerable = (IEnumerable)obj; if (enumerable != null) { foreach (object item2 in enumerable) { CustomItem val = (CustomItem)((item2 is CustomItem) ? item2 : null); GameObject val2 = ((val != null) ? val.ItemPrefab : null); if ((Object)(object)val2 != (Object)null && hashSet.Add(((Object)val2).name)) { list.Add(val2); num2++; } } } } catch (Exception) { } try { ItemDrop[] array = Resources.FindObjectsOfTypeAll<ItemDrop>(); foreach (ItemDrop val3 in array) { if ((Object)(object)val3 == (Object)null) { continue; } GameObject gameObject = ((Component)val3).gameObject; Scene scene = gameObject.scene; if (((Scene)(ref scene)).IsValid()) { scene = gameObject.scene; if (((Scene)(ref scene)).name != "DontDestroyOnLoad") { continue; } } if (hashSet.Add(((Object)gameObject).name)) { list.Add(gameObject); num3++; } } } catch (Exception ex2) { Log.LogInfo((object)("[Items] could not scan the loaded prefabs: " + ex2.GetType().Name + ": " + ex2.Message)); } itemIndex = new Dictionary<string, GameObject>(); foreach (GameObject item3 in list) { itemIndex[((Object)item3).name] = item3; } if (!itemSourcesLogged) { itemSourcesLogged = true; Verbose("[Items] " + list.Count + " item prefabs: " + num + " from the item database, " + num2 + " from other Jotunn mods, " + num3 + " more loaded from asset bundles"); } return list; } internal static GameObject FindItemPrefab(string name) { GameObject prefab = PrefabManager.Instance.GetPrefab(name); if ((Object)(object)prefab != (Object)null) { return prefab; } if (itemIndex == null) { AllItemPrefabs(); } if (itemIndex == null || !itemIndex.TryGetValue(name, out var value)) { return null; } return value; } internal static GameObject CloneItem(string newName, string baseName, GameObject basePrefab) { if ((Object)(object)PrefabManager.Instance.GetPrefab(baseName) != (Object)null) { return PrefabManager.Instance.CreateClonedPrefab(newName, baseName); } return PrefabManager.Instance.CreateClonedPrefab(newName, basePrefab); } internal static Dictionary<string, Recipe> RecipeIndex() { if (recipeIndex != null) { return recipeIndex; } Dictionary<string, Recipe> dictionary = new Dictionary<string, Recipe>(); if ((Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_recipes != null) { foreach (Recipe recipe in ObjectDB.instance.m_recipes) { if (!((Object)(object)recipe == (Object)null) && !((Object)(object)recipe.m_item == (Object)null)) { string name = ((Object)((Component)recipe.m_item).gameObject).name; if (!dictionary.ContainsKey(name)) { dictionary[name] = recipe; } } } } if (dictionary.Count > 0) { recipeIndex = dictionary; } return dictionary; } internal static void StationFor(string baseName, string defaultStation, int defaultLevel, out string station, out int level) { station = defaultStation; level = defaultLevel; if (RecipeIndex().TryGetValue(baseName, out var value) && (Object)(object)value.m_craftingStation != (Object)null && (Object)(object)((Component)value.m_craftingStation).gameObject != (Object)null) { station = ((Object)((Component)value.m_craftingStation).gameObject).name; level = Mathf.Max(1, value.m_minStationLevel); } } internal static void FixRecipeStations() { if (AutoBases.Count == 0 || (Object)(object)ObjectDB.instance == (Object)null || ObjectDB.instance.m_recipes == null) { return; } Dictionary<string, Recipe> dictionary = new Dictionary<string, Recipe>(); foreach (Recipe recipe in ObjectDB.instance.m_recipes) { if (!((Object)(object)recipe == (Object)null) && !((Object)(object)recipe.m_item == (Object)null)) { string name = ((Object)((Component)recipe.m_item).gameObject).name; if (!dictionary.ContainsKey(name)) { dictionary[name] = recipe; } } } int num = 0; foreach (KeyValuePair<string, string> autoBasis in AutoBases) { if (dictionary.TryGetValue(autoBasis.Key, out var value) && dictionary.TryGetValue(autoBasis.Value, out var value2) && !((Object)(object)value2.m_craftingStation == (Object)null)) { int num2 = Mathf.Max(1, value2.m_minStationLevel); if (!((Object)(object)value.m_craftingStation == (Object)(object)value2.m_craftingStation) || value.m_minStationLevel != num2) { value.m_craftingStation = value2.m_craftingStation; value.m_repairStation = (((Object)(object)value2.m_repairStation != (Object)null) ? value2.m_repairStation : value2.m_craftingStation); value.m_minStationLevel = num2; num++; } } } if (num > 0 && !stationsFixLogged) { stationsFixLogged = true; Verbose("[Cloning] set the forging station of " + num + " Firebrand recipes to match the items they are made from"); } } internal static bool NameExcluded(string prefab) { if (prefab.IndexOf("Firebrand", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } string text = ((CloneExclude != null) ? CloneExclude.Value : ""); if (string.IsNullOrEmpty(text)) { return false; } string[] array = text.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim(); if (text2.Length > 0 && prefab.IndexOf(text2, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } internal static string LocalizedName(GameObject basePrefab) { try { ItemDrop val = (((Object)(object)basePrefab != (Object)null) ? basePrefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val == (Object)null || val.m_itemData == null || val.m_itemData.m_shared == null) { return null; } string name = val.m_itemData.m_shared.m_name; if (string.IsNullOrEmpty(name)) { return null; } string text = Translate(name); if (string.IsNullOrEmpty(text) || text.IndexOf('$') >= 0 || text.StartsWith("[")) { return null; } return TitleCase(text.Trim()); } catch (Exception) { return null; } } private static string Translate(string token) { try { if (!localizationLooked) { localizationLooked = true; localizationType = AccessTools.TypeByName("Localization"); if (localizationType != null) { localizationInstanceProp = AccessTools.Property(localizationType, "instance"); if (localizationInstanceProp == null) { localizationInstanceField = AccessTools.Field(localizationType, "instance"); } localizeMethod = AccessTools.Method(localizationType, "Localize", new Type[1] { typeof(string) }, (Type[])null); } } if (localizeMethod == null) { return token; } object obj = ((localizationInstanceProp != null) ? localizationInstanceProp.GetValue(null, null) : ((localizationInstanceField != null) ? localizationInstanceField.GetValue(null) : null)); if (obj == null) { return token; } return (localizeMethod.Invoke(obj, new object[1] { token }) as string) ?? token; } catch (Exception) { return token; } } internal static string AutoDisplayName(GameObject basePrefab, string baseName) { string text = LocalizedName(basePrefab); if (!string.IsNullOrEmpty(text)) { return "Firebrand " + text; } string text2 = Humanize(baseName); return "Firebrand " + ((text2.Length > 0) ? text2 : baseName); } private static string TitleCase(string text) { string[] array = text.Split(new char[1] { ' ' }); for (int i = 0; i < array.Length; i++) { string text2 = array[i]; if (text2.Length == 0) { continue; } if (i > 0) { switch (text2) { case "of": case "the": case "and": case "in": continue; } if (text2 == "on") { continue; } } if (char.IsLower(text2[0])) { array[i] = char.ToUpperInvariant(text2[0]) + text2.Substring(1); } } return string.Join(" ", array); } internal static string Humanize(string prefab) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < prefab.Length; i++) { char c = prefab[i]; if (c == '_' || c == '-') { stringBuilder.Append(' '); continue; } if (i > 0 && char.IsUpper(c) && char.IsLower(prefab[i - 1])) { stringBuilder.Append(' '); } stringBuilder.Append(c); } return stringBuilder.ToString().Trim(); } private void BindGear() { GearWithSword = ((BaseUnityPlugin)this).Config.Bind<bool>("Gear", "EmberWhileHoldingFirebrand", true, "While a Firebrand sword is held, the armor, capes, shield and skin being worn get the ember cracks (and the shield its fire on block). Settings for the look are in the Armor, Capes, Shields and Skin sections. Off = nothing changes on the player when a sword is drawn. The shield size and back position do not depend on this; they always apply."); GearFlare = ((BaseUnityPlugin)this).Config.Bind<bool>("Gear", "FlareWhenDrawn", true, "A puff of fire rises around a player when they take up a Firebrand sword, so the ember look on their gear doesn't just appear. Every player with the mod sees it on everybody."); SkinEmbers = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "Embers", true, "While a Firebrand sword is held, the skin of the character gets the same glowing ember cracks as the gear. It needs the skin's material to have a place for glow; the BepInEx log says as [Skin] whether it does. Off = no change to the skin."); SkinEmberIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "EmberIntensity", 0.6f, "How brightly the ember cracks glow on skin."); SkinGlowIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "GlowIntensity", 0.1f, "A faint even heat under the cracks. 0 = none."); SkinEmberTiles = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "EmberTiles", 4f, "How many crack strips fit across the skin's texture. Higher = finer, more repeated cracks."); SkinSparks = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "SparksIfNoGlow", true, "If the skin's material can't show a glow, small embers rise off the body instead, so there is still something. Off = nothing in that case."); } internal static float RoundShieldFactor(GameObject shieldPrefab) { if ((Object)(object)shieldPrefab == (Object)null || !ShieldResize.Value || (Object)(object)ObjectDB.instance == (Object)null) { return 1f; } if (shieldFactors.TryGetValue(((Object)shieldPrefab).name, out var value)) { return value; } if (shieldTarget < 0f) { float roundness; float num = FaceSize(ObjectDB.instance.GetItemPrefab("ShieldSilver"), out roundness); float num2 = FaceSize(ObjectDB.instance.GetItemPrefab("ShieldBanded"), out roundness); shieldTarget = 0f; if (num > 0f && num2 > 0f) { shieldTarget = Mathf.Lerp(num, num2, Mathf.Clamp(ShieldSizeBetween.Value, 0f, 1.5f)); Verbose("[Shields] Silver face " + num.ToString("0.000") + ", Banded face " + num2.ToString("0.000") + " -> round shields are brought to " + shieldTarget.ToString("0.000")); } else { Log.LogWarning((object)"[Shields] could not measure the Silver and Banded shields; round shields keep their size."); } } float num3 = 1f; float roundness2; float num4 = FaceSize(shieldPrefab, out roundness2); if (shieldTarget > 0f && num4 > 0f && roundness2 >= 0.85f) { num3 = Mathf.Clamp(shieldTarget / num4, 0.5f, 2f); } shieldFactors[((Object)shieldPrefab).name] = num3; Verbose("[Shields] " + ((Object)shieldPrefab).name + ": size " + num4.ToString("0.000") + ", roundness " + roundness2.ToString("0.00") + ((Mathf.Abs(num3 - 1f) > 0.005f) ? (" -> round, scaled x" + num3.ToString("0.00")) : " -> size kept")); return num3; } private void BindLeap() { LeapEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Leap", "Enabled", true, "Jumping while a Firebrand sword is in your hand launches you high into the air. Off = normal jumps."); LeapHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Leap", "HeightMeters", 7.1f, "How high the leap carries you, in meters, measured from where you took off. 7.1 m is about 23 feet."); LeapForward = ((BaseUnityPlugin)this).Config.Bind<float>("Leap", "ForwardSpeed", 10f, "Extra speed (m/s) added in the direction you are moving, or facing if you stand still, when you leap, so it is a bound forward and not just a jump straight up. 0 = the leap goes as far sideways as your normal jump would."); LeapStamina = ((BaseUnityPlugin)this).Config.Bind<float>("Leap", "ExtraStaminaCost", 0f, "Stamina a leap costs on top of the normal jump. If you don't have it you get a normal jump instead. 0 = free."); LeapCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Leap", "CooldownSeconds", 0.5f, "Seconds after landing before the next jump can leap again (a jump in between is a normal jump). 0 = none."); LeapLanding = ((BaseUnityPlugin)this).Config.Bind<bool>("Leap", "BlastOnLanding", true, "Where you land, the same fiery blast (and mace impact) as the secondary attack and the thrown sword, with the same radius and fire damage. Turn the blast itself off under [Explosion] Enabled."); LeapTrailOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Leap", "Trail", true, "Flames, sparks and smoke trail behind you during the leap. Other players who run this mod see it too (Multiplayer settings)."); LeapTrailSize = ((BaseUnityPlugin)this).Config.Bind<float>("Leap", "TrailSize", 3f, "Size of the trail. 1 = about the size of your body; lower is slimmer, higher is bigger."); LeapSmokeOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Leap", "Smoke", true, "Smoke in the trail."); LeapLight = ((BaseUnityPlugin)this).Config.Bind<float>("Leap", "TrailLight", 5.6f, "Brightness of the firelight that travels with you during the leap. 0 = none."); } private void BindNet() { ShareMyEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("Multiplayer", "ShareMyEffects", true, "Send my thrown sword, blasts, hit sparks, leap trail and burning enemies to the other players so they see them too."); ShowOthersEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("Multiplayer", "ShowOthersEffects", true, "Show the effects other players send me: their thrown swords, blasts, hit sparks, leap trails and burning enemies."); } internal static void Verbose(string message) { if (VerboseLog != null && VerboseLog.Value && Log != null) { Log.LogInfo((object)message); } } private void Awake() { //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0739: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_09d9: Unknown result type (might be due to invalid IL or missing references) //IL_09e4: Expected O, but got Unknown VerboseLog = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "VerboseLog", false, "Write detailed diagnostic lines to the BepInEx log (what the mod found and copied from the game, which other mods hook attacks, every blast and leap). Turn on when reporting a problem; leave off otherwise."); FireRatio = ((BaseUnityPlugin)this).Config.Bind<float>("Damage", "FireRatio", 0.5f, "Fire damage added = this fraction of the base sword's total vanilla damage (blunt + slash + pierce + true). Same ratio is applied to damage per upgrade level."); FlatFireBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Damage", "FlatFireBonus", 0f, "Extra flat fire damage added on top of the ratio-based amount."); Cores = ((BaseUnityPlugin)this).Config.Bind<int>("Recipe", "SurtlingCores", 8, "Surtling cores to forge a firebrand from its base sword."); Coal = ((BaseUnityPlugin)this).Config.Bind<int>("Recipe", "Coal", 10, "Coal to forge a firebrand from its base sword."); CopyVisuals = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "CopyDyrnwynFlames", true, "Copy Dyrnwyn's own fire particles and light onto the new swords, fitted to each blade."); FlameScale = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "FlameScale", 1f, "Overall size of the whole flame effect (spread and emitter size). 1 = same as Dyrnwyn, scaled to the blade."); LightMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "LightMultiplier", 1f, "Multiplier on the copied Dyrnwyn light intensity. 0 removes the light."); GlowBlades = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "GlowBlades", true, "Add a subtle ember glow to the blade only (hilt and guard are left untouched)."); GlowIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "GlowIntensity", 0.3f, "Blade glow strength. ~0.3 is a faint heat, ~0.5 is a warm glow, 1+ starts to look like a lightsaber."); ParticleSizeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "ParticleSizeMultiplier", 1f, "Size of each individual flame particle. Lower = finer, smaller wisps. 1 = Dyrnwyn's original particle size."); EmissionMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "EmissionMultiplier", 1f, "Particles spawned per second relative to Dyrnwyn. Raise this when you lower ParticleSizeMultiplier so the flame stays full."); ExcludeParticleNames = ((BaseUnityPlugin)this).Config.Bind<string>("Visuals", "ExcludeParticleNames", "", "Comma separated name fragments of Dyrnwyn particle systems to drop (e.g. smoke,glow). Names are printed in the BepInEx log as [DyrnwynFX]."); Log = ((BaseUnityPlugin)this).Logger; ExcludeNodeNames = ((BaseUnityPlugin)this).Config.Bind<string>("Visuals", "ExcludeDyrnwynNodes", "UpgraderGlow", "Comma separated name fragments of Dyrnwyn effect objects NOT to copy (the object and everything under it). UpgraderGlow is Dyrnwyn's upgrade glow, not its fire. Names are printed in the log as [DyrnwynFX] node."); Instance = this; FlameSideOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "FlameOffsetX", 0f, "Nudge the flames along the sword's local X axis (meters). Use with FlameOffsetY if the fire sits off the blade."); FlameLiftOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "FlameOffsetY", 0f, "Nudge the flames along the sword's local Y axis (meters). The BepInEx log prints each sword's blade axis."); FlameForwardOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "FlameOffsetZ", 0f, "Nudge the flames along the sword's local Z axis (meters). X, Y and Z changes apply live in the F1 window."); BladeTextureBlend = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "BladeTextureBlend", 0.5f, "Mix of Dyrnwyn's blade texture into each Firebrand blade. 0 = the sword's own look, 1 = Dyrnwyn's. Needs GlowBlades on. The hilt and guard are never touched."); EmberTexture = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "EmberTexture", true, "Blade glow as glowing ember cracks (the pattern of the Charred's Dyrnwyn, read from the game at runtime; a similar generated pattern if it isn't found) instead of one even tint. Needs GlowBlades on."); EmberIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "EmberIntensity", 0.9f, "Brightness of the ember cracks. GlowIntensity still sets the faint even heat underneath them. ~0.9 = glowing cracks, 1.5+ gets very bright."); DyrnwynPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("Visuals", "DyrnwynPrefab", "auto", "Which item the flames are copied from. auto = the real Dyrnwyn (SwordDyrnwyn) if it has fire effects, otherwise the older SwordIronFire. Or type an item prefab name to force one."); FlameSpread = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "FlameSpread", 1f, "How much of Dyrnwyn's own flame placement around the blade to keep. 1 = the same arrangement as Dyrnwyn, 0 = everything straight down the blade's middle."); ThrowAnimationEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Throw", "PlayThrowAnimation", true, "Play a throwing animation and release the sword at the end of it."); ThrowAnimationName = ((BaseUnityPlugin)this).Config.Bind<string>("Throw", "ThrowAnimation", "spear_throw", "Animator trigger used for the throw. spear_throw is vanilla's spear throw."); MaceSecondary = ((BaseUnityPlugin)this).Config.Bind<bool>("Secondary", "UseMaceAttack", true, "Firebrand swords use a mace's secondary attack (the overhead smash) instead of the sword's own: the one-handed mace for one-handed swords, the two-handed mace (sledge) for two-handed ones."); MaceSecondarySource = ((BaseUnityPlugin)this).Config.Bind<string>("Secondary", "MaceItem", "MaceIron", "Which one-handed mace's secondary attack the one-handed swords copy (an item prefab name, e.g. MaceIron, MaceBronze, MaceSilver, MaceNeedle)."); MaceSecondaryTwoHanded = ((BaseUnityPlugin)this).Config.Bind<bool>("Secondary", "UseMaceAttackTwoHanded", false, "Two-handed Firebrand swords swing a two-handed mace's attack as their secondary. Off (default): they keep their own vanilla secondary attack. Needs UseMaceAttack on as well."); MaceSecondarySourceTwoHanded = ((BaseUnityPlugin)this).Config.Bind<string>("Secondary", "TwoHandedMaceItem", "SledgeIron", "Which two-handed mace's secondary attack the two-handed swords copy when UseMaceAttackTwoHanded is on (e.g. SledgeIron, SledgeStagbreaker, SledgeDemolisher). Thrown swords replay that mace's impact effects either way."); ExplosionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosion", "Enabled", true, "Fiery explosion (bomb-style) where the secondary attack lands and where a thrown sword first hits something."); ExplosionOnSecondary = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosion", "OnSecondaryAttack", true, "Explode where the secondary (mace smash) attack lands."); ExplosionOnThrow = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosion", "OnThrownHit", true, "Explode where a thrown sword first touches an enemy or the world."); MaceImpactOnThrow = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosion", "MaceImpactOnThrownHit", true, "Where a thrown sword first lands (any Firebrand sword, one- or two-handed, vanilla or modded) also play the impact effects of the two-handed mace smash that the two-handed swords use for their secondary attack: its ground and hit effects and whatever the smash spawns. They always lie flat (horizontal), whatever the ground or the sword's angle. The log lists them as [MaceImpact]."); ExplosionRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "Radius", 4f, "Blast radius in meters."); ExplosionDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "DamageMultiplier", 1f, "Blast fire damage as a multiple of the sword's own fire damage. Enemies at the edge of the blast take less."); ExplosionPush = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "PushForce", 40f, "How hard the blast shoves enemies away."); ExplosionLight = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "FlashLight", 5f, "Brightness of the flash. 0 = none."); ExplosionEffectLifetime = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "EffectLifetime", 6f, "How long the fire a blast leaves where it lands keeps burning, in seconds. It is made from the sword's own flames."); ExplosionUseBombEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosion", "UseBombEffects", true, "Also play the sounds and effects of a vanilla bomb or fireball (see BombSource) on top of the fire blast."); ExplosionBombSource = ((BaseUnityPlugin)this).Config.Bind<string>("Explosion", "BombSource", "auto", "Which vanilla item's explosion effects to play. auto = the first of BombFire, BombLava, StaffFireball, BombOoze that exists. Or type an item prefab name. The bombs found in your game are listed in the log as [Explosion]."); ThrowReleaseDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "ReleaseDelay", 0.7f, "Seconds between the throw animation starting and the sword leaving your hand."); RecallEmote = ((BaseUnityPlugin)this).Config.Bind<string>("Throw", "RecallEmote", "point", "Emote played while you call the sword back: an arm stretched out to catch it. Vanilla emote names: point, wave, challenge, cheer, comfort, flex... Empty = no animation. Standing still lets it play fully; moving ends an emote."); RecallDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "RecallDelay", 0.3f, "Seconds the sword hangs and shudders before it flies back, so the arm is out first."); TrailEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trail", "Enabled", true, "Flame trail behind the blade during swings (and while a thrown sword flies)."); TrailMinSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Trail", "MinBladeSpeed", 3f, "Blade tip speed (m/s) needed before the trail shows. Lower = trail appears earlier in a swing."); TrailSize = ((BaseUnityPlugin)this).Config.Bind<float>("Trail", "ParticleSize", 0.14f, "Size of each trail flame particle."); TrailLifetime = ((BaseUnityPlugin)this).Config.Bind<float>("Trail", "Lifetime", 0.4f, "How long trail flames linger, in seconds."); TrailDensity = ((BaseUnityPlugin)this).Config.Bind<float>("Trail", "Density", 1f, "How many trail particles are spawned. 2 = twice as thick."); ImpactEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Impact", "Enabled", true, "Burst of embers and a quick flash where a swing (or throw) connects. Other players see yours too (Multiplayer settings)."); ImpactParticles = ((BaseUnityPlugin)this).Config.Bind<int>("Impact", "Particles", 28, "Embers per impact."); ImpactLight = ((BaseUnityPlugin)this).Config.Bind<float>("Impact", "FlashLight", 2.5f, "Brightness of the impact flash. 0 = no light."); ThrowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Throw", "Enabled", true, "Allow throwing and recalling Firebrand swords."); ThrowKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Throw", "ThrowKey", new KeyboardShortcut((KeyCode)102, Array.Empty<KeyCode>()), "Throws the Firebrand sword in your hand. Press it again while the sword is out to call it back. Any key or mouse button (e.g. Mouse3, Mouse4). Set to None to disable."); RecallKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Throw", "RecallKey", new KeyboardShortcut((KeyCode)102, Array.Empty<KeyCode>()), "Calls the thrown sword back to your hand; it hits enemies on the way. Same key as the throw by default; give it its own key to separate them. Set to None to disable."); ThrowKeyAlsoRecalls = ((BaseUnityPlugin)this).Config.Bind<bool>("Throw", "ThrowKeyAlsoRecalls", true, "Pressing the throw key while a sword is out also calls it back."); ThrowStamina = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "StaminaCost", 15f, "Stamina used per throw."); ThrowSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "ThrowSpeed", 32f, "Flight speed in m/s."); ThrowRange = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "Range", 40f, "Distance in meters before the sword drops."); ReturnSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "ReturnSpeed", 45f, "Top speed of the sword flying home, in m/s."); ThrowDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "DamageMultiplier", 1f, "Thrown hit damage relative to a normal swing of the same sword (fire included)."); SpinSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "SpinDegreesPerSecond", 540f, "Tumble speed while flying. 0 = flies point-first."); AutoRecallSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "AutoRecallSeconds", 15f, "A sword stuck in the ground flies back by itself after this many seconds. 0 = only when you recall it."); Verbose("[Config] FlameScale=" + FlameScale.Value + " ParticleSizeMultiplier=" + ParticleSizeMultiplier.Value + " EmissionMultiplier=" + EmissionMultiplier.Value + " LightMultiplier=" + LightMultiplier.Value + " FlameSpread=" + FlameSpread.Value + " GlowIntensity=" + GlowIntensity.Value + " EmberIntensity=" + EmberIntensity.Value + " BladeTextureBlend=" + BladeTextureBlend.Value + " offsets=(" + FlameSideOffset.Value + ", " + FlameLiftOffset.Value + ", " + FlameForwardOffset.Value + ")"); Harmony val = new Harmony("brett.swordfirebrand"); val.PatchAll(); ShieldAttachPatch.Apply(val); BindCloning(); BindShields(); BindArmor(); BindGear(); BindSecondary(); BindNet(); BindBurn(); BindLeap(); PrefabManager.OnVanillaPrefabsAvailable += AddSwords; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Sword Firebrand loaded. Swords register through Jotunn."); } private void LateUpdate() { GearGlow.Size(); } private void FixedUpdate() { Leap.FixedTick(); } private void Update() { //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_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) SecondaryPriorityPatch.RestoreStale(); FirebrandNet.Tick(); GearGlow.Tick(); Leap.Tick(); if (!ThrowEnabled.Value || !ThrowSystem.InputAllowed()) { return; } Player localPlayer = Player.m_localPlayer; ThrownFirebrand active = ThrowSystem.Active; KeyboardShortcut value = ThrowKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { if ((Object)(object)active != (Object)null) { if (ThrowKeyAlsoRecalls.Value) { active.StartRecall(); } } else { ThrowSystem.TryThrow(localPlayer); } } if ((Object)(object)active != (Object)null) { value = RecallKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { active.StartRecall(); } } } private void AddSwords() { if (!CloneModdedItems.Value) { PrefabManager.OnVanillaPrefabsAvailable -= AddSwords; } List<SwordDef> list = new List<SwordDef>(SwordDef.All); HashSet<string> hashSet = new HashSet<string>(); foreach (SwordDef item in list) { hashSet.Add(item.BaseName); } DiscoverSwords(list, hashSet); List<SwordDef> list2 = new List<SwordDef>(); foreach (SwordDef item2 in list) { if ((Object)(object)FindItemPrefab(item2.BaseName) != (Object)null && (Object)(object)PrefabManager.Instance.GetPrefab(item2.BaseName + "_Firebrand") == (Object)null) { list2.Add(item2); } } if (list2.Count == 0) { return; } string text = ((DyrnwynPrefab.Value == null) ? "auto" : DyrnwynPrefab.Value.Trim()); string[] obj = ((!string.Equals(text, "auto", StringComparison.OrdinalIgnoreCase) && text.Length != 0) ? new string[1] { text } : new string[2] { "SwordDyrnwyn", "SwordIronFire" }); GameObject val = null; FireRig fireRig = null; string[] array = obj; foreach (string text2 in array) { GameObject prefab = PrefabManager.Instance.GetPrefab(text2); if ((Object)(object)prefab == (Object)null) { Verbose("[Source] prefab " + text2 + " not found"); continue; } if ((Object)(object)val == (Object)null) { val = prefab; } if (!CopyVisuals.Value) { break; } FireRig fireRig2 = FireRig.Read(prefab); if (fireRig2 == null) { Verbose("[Source] " + text2 + " has no usable fire effects"); continue; } fireRig = fireRig2; val = prefab; Verbose("[Source] fire effects copied from " + text2); break; } if (CopyVisuals.Value) { if (fireRig == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Dyrnwyn prefab or its fire effects were not found. Falling back to torch flames."); } else { Verbose("Read " + fireRig.Nodes.Count + " fire nodes from Dyrnwyn (blade axis " + fireRig.Span.Axis + ", tip sign " + fireRig.TipSign + ")."); } } FlameMaterial = PickMaterial(val); if ((Object)(object)FlameMaterial == (Object)null) { FlameMaterial = PickMaterial(PrefabManager.Instance.GetPrefab("Torch")); } try { BurnFlames.Capture(val, PrefabManager.Instance.GetPrefab("Torch")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[Burn] could not read the flame particles: " + ex.GetType().Name + ": " + ex.Message)); } Attack val2 = FindSecondary("one-handed", MaceSecondarySource.Value, new string[4] { "MaceIron", "MaceBronze", "MaceSilver", "MaceNeedle" }, null); SharedData val3 = lastSecondarySource; string name = lastSecondaryName; Attack val4 = FindSecondary("two-handed", MaceSecondarySourceTwoHanded.Value, new string[3] { "SledgeIron", "SledgeStagbreaker", "SledgeDemolisher" }, "TwoHandedClub"); if (val4 != null && lastSecondarySource != null) { MaceImpact.Set(val4, lastSecondarySource, lastSecondaryName); } else if (val2 != null && val3 != null) { MaceImpact.Set(val2, val3, name); } if (!MaceSecondary.Value) { val2 = null; } if (!MaceSecondary.Value || !MaceSecondaryTwoHanded.Value) { val4 = null; } int num = 0; int num2 = 0; foreach (SwordDef item3 in list2) { try { if (MakeSword(item3, fireRig, val2, val4)) { num++; if (!item3.Known) { num2++; } } } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[Swords] " + item3.BaseName + " could not be cloned: " + ex2.GetType().Name + ": " + ex2.Message)); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Registered " + num + " firebrand swords (" + num2 + " found in the game, the rest from the built-in list).")); } private void DiscoverSwords(List<SwordDef> defs, HashSet<string> known) { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Invalid comparison between Unknown and I4 //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Invalid comparison between Unknown and I4 //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Invalid comparison between Unknown and I4 List<string> list = new List<string>(); string[] array = (SwordsExtra.Value ?? "").Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length != 0 && !known.Contains(text)) { GameObject val = FindItemPrefab(text); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[Swords] ExtraSwords: " + text + " is not in this game")); continue; } defs.Add(SwordDef.Auto(text, AutoDisplayName(val, text))); known.Add(text); } } if (!SwordsCloneAll.Value || !CloneModdedItems.Value) { return; } Dictionary<string, Recipe> dictionary = RecipeIndex(); List<GameObject> list2 = AllItemPrefabs(); foreach (GameObject item in list2) { ItemDrop val2 = (((Object)(object)item != (Object)null) ? item.GetComponent<ItemDrop>() : null); if ((Object)(object)val2 == (Object)null || val2.m_itemData == null || val2.m_itemData.m_shared == null) { continue; } SharedData shared = val2.m_itemData.m_shared; if (((int)shared.m_itemType == 3 || (int)shared.m_itemType == 14) && (int)shared.m_skillType == 1 && !known.Contains(((Object)item).name) && !((Object)item).name.EndsWith("_Firebrand")) { bool flag = dictionary.ContainsKey(((Object)item).name); if (NameExcluded(((Object)item).name) || (CloneRequireRecipe.Value && !flag)) { list.Add(((Object)item).name); continue; } defs.Add(SwordDef.Auto(((Object)item).name, AutoDisplayName(item, ((Object)item).name))); known.Add(((Object)item).name); } } Verbose("[Swords] looked through " + list2.Count + " item prefabs: " + (defs.Count - SwordDef.All.Length) + " more swords to clone"); if (list.Count > 0 && !swordsLeftLogged) { swordsLeftLogged = true; if (list.Count > 60) { list.RemoveRange(60, list.Count - 60); } Verbose("[Swords] sword-skill weapons left alone (add a name to Swords/ExtraSwords to clone one anyway): " + string.Join(" ", list.ToArray())); } } private bool MakeSword(SwordDef def, FireRig rig, Attack maceSecondary, Attack maceSecondaryTwoHanded) { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Invalid comparison between Unknown and I4 //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown GameObject val = FindItemPrefab(def.BaseName); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Missing base sword " + def.BaseName)); return false; } string text = def.BaseName + "_Firebrand"; if ((Object)(object)PrefabManager.Instance.GetPrefab(text) != (Object)null) { return false; } if (!def.Known) { Transform val2 = val.transform.Find("attach"); if ((Object)(object)val2 == (Object)null || !Measure(val2, -1).Valid) { Verbose("[Swords] " + def.BaseName + " has no sword model this mod can use; skipped"); return false; } } GameObject val3 = CloneItem(text, def.BaseName, val); if ((Object)(object)val3 == (Object)null) { return false; } ItemDrop component = val3.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null) { return false; } SharedData shared = component.m_itemData.m_shared; float num = TotalPhysical(shared.m_damages); float num2 = TotalPhysical(shared.m_damagesPerLevel); float num3 = num * FireRatio.Value + FlatFireBonus.Value; if (num3 < 1f) { num3 = 1f; } float num4 = num2 * FireRatio.Value; shared.m_damages.m_fire += num3; shared.m_damagesPerLevel.m_fire += num4; shared.m_name = def.DisplayName; shared.m_description = "A " + def.DisplayName + " reforged around Dyrnwyn's flame. Same edge, plus fire."; Attack val4 = (((int)shared.m_itemType == 14) ? maceSecondaryTwoHanded : maceSecondary); if (val4 != null) { shared.m_secondaryAttack = val4.Clone(); } float num5 = DefaultBladeStart(val3, rig, def); if (def.Known) { num5 = ((BaseUnityPlugin)this).Config.Bind<float>("BladeGlow", def.BaseName + "_BladeStart", num5, "Where the blade begins along the sword (0 = pommel end, 1 = tip). Glow starts here, so the grip and guard stay unlit. Raise it if the guard glows, lower it if the base of the blade doesn't.").Value; } if (CopyVisuals.Value) { ApplyVisuals(val3, rig, num5); } AddBladeComponent(val3, rig, num5); ItemManager.Instance.AddItem(new CustomItem(val3, true)); string station; int level; if (def.Known) { station = def.Station; level = def.StationLevel; } else { StationFor(def.BaseName, def.Station, def.StationLevel, out station, out level); } AddFirebrandRecipe(component, def.BaseName, station, level, Cores.Value, Coal.Value); if (!def.Known) { AutoBases[text] = def.BaseName; } Verbose("Registered " + text + ": base " + num + " -> +" + shared.m_damages.m_fire + " fire."); return true; } private Attack FindSecondary(string label, string configured, string[] fallbacks, string animationState) { lastSecondarySource = null; lastSecondaryName = null; List<string> list = new List<string>(); string text = ((configured == null) ? "" : configured.Trim()); if (text.Length > 0) { list.Add(text); } list.AddRange(fallbacks); Attack val = null; string text2 = null; SharedData val2 = null; foreach (string item in list) { GameObject prefab = PrefabManager.Instance.GetPrefab(item); ItemDrop val3 = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val3 == (Object)null || val3.m_itemData == null || val3.m_itemData.m_shared == null) { Verbose("[Secondary] " + label + " candidate " + item + ": not in this game"); continue; } SharedData shared = val3.m_itemData.m_shared; Attack secondaryAttack = shared.m_secondaryAttack; Attack attack = shared.m_attack; bool flag = secondaryAttack != null && !string.IsNullOrEmpty(secondaryAttack.m_attackAnimation); bool flag2 = attack != null && !string.IsNullOrEmpty(attack.m_attackAnimation); Verbose("[Secondary] " + label + " candidate " + item + ": swings as " + ((object)Unsafe.As<AnimationState, AnimationState>(ref shared.m_animationState)/*cast due to .constrained prefix*/).ToString() + ", primary '" + (flag2 ? attack.m_attackAnimation : "none") + "', secondary '" + (flag ? secondaryAttack.m_attackAnimation : "none") + "'"); if (flag) { Verbose("[Secondary] " + label + " swords copy the secondary attack of " + item + " (animation " + secondaryAttack.m_attackAnimation + ")"); lastSecondarySource = shared; lastSecondaryName = item; return secondaryAttack; } if (flag2 && val == null) { val = attack; text2 = item; val2 = shared; } } if (animationState != null) { StringBuilder stringBuilder = new StringBuilder(); string text3 = null; Attack val4 = null; SharedData val5 = null; bool flag3 = false; foreach (GameObject item2 in AllItemPrefabs()) { ItemDrop component = item2.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null) { continue; } SharedData shared2 = component.m_itemData.m_shared; if (!(((object)Unsafe.As<AnimationState, AnimationState>(ref shared2.m_animationState)/*cast due to .constrained prefix*/).ToString() != animationState)) { Attack secondaryAttack2 = shared2.m_secondaryAttack; Attack attack2 = shared2.m_attack; bool flag4 = secondaryAttack2 != null && !string.IsNullOrEmpty(secondaryAttack2.m_attackAnimation); bool flag5 = attack2 != null && !string.IsNullOrEmpty(attack2.m_attackAnimation); stringBuilder.Append(((Object)item2).name).Append("(").Append(flag5 ? attack2.m_attackAnimation : "-") .Append("/") .Append(flag4 ? secondaryAttack2.m_attackAnimation : "-") .Append(") "); bool flag6 = ((Object)item2).name.Contains("Sledge"); if (flag4 && (val4 == null || (flag6 && !flag3))) { val4 = secondaryAttack2; text3 = ((Object)item2).name; val5 = shared2; flag3 = flag6; } else if (flag5 && val == null && !((Object)item2).name.EndsWith("_Firebrand")) { val = attack2; text2 = ((Object)item2).name; val2 = shared2; } } } Verbose("[Secondary] items that swing as " + animationState + " (primary/secondary): " + ((stringBuilder.Length > 0) ? stringBuilder.ToString().Trim() : "none found")); if (val4 != null) { Verbose("[Secondary] " + label + " swords copy the secondary attack of " + text3 + " (animation " + val4.m_attackAnimation + ")"); lastSecondarySource = val5; lastSecondaryName = text3; return val4; } } if (val != null) { Verbose("[Secondary] " + label + ": no secondary attack found; swords use the main swing of " + text2 + " (animation " + val.m_attackAnimation + ") as their secondary"); lastSecondarySource = val2; lastSecondaryName = text2; return val; } ((BaseUnityPlugin)this).Logger.LogWarning((object)("[Secondary] no " + label + " mace attack was found; those swords keep their own secondary.")); return null; } private static float TotalPhysical(DamageTypes d) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return d.m_damage + d.m_blunt + d.m_slash + d.m_pierce; } private void AddRecipe(ItemDrop result, SwordDef def) { AddFirebrandRecipe(result, def.BaseName, def.Station, def.StationLevel, Cores.Value, Coal.Value); } private void AddFirebrandRecipe(ItemDrop result, string baseName, string stationName, int stationLevel, int coreAmount, int coalAmount) { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown ItemDrop val = Item(baseName); ItemDrop val2 = Item("SurtlingCore"); ItemDrop val3 = Item("Coal"); CraftingStation val4 = Station(stationName); if ((Object)(object)val4 == (Object)null && stationName != "forge") { val4 = Station("forge"); } if ((Object)(object)result == (Object)null || (Object)(object)val == (Object)null || (Object)(object)val4 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Recipe skipped for " + baseName)); return; } List<Requirement> list = new List<Requirement> { Req(val, 1, 0) }; if ((Object)(object)val2 != (Object)null) { list.Add(Req(val2, coreAmount, 2)); } if ((Object)(object)val3 != (Object)null) { list.Add(Req(val3, coalAmount, 2)); } Recipe val5 = ScriptableObject.CreateInstance<Recipe>(); ((Object)val5).name = ((Object)((Component)result).gameObject).name + "_recipe"; val5.m_item = result; val5.m_amount = 1; val5.m_enabled = true; val5.m_resources = list.ToArray(); val5.m_craftingStation = val4; val5.m_minStationLevel = stationLevel; val5.m_repairStation = val4; ItemManager.Instance.AddRecipe(new CustomRecipe(val5, true, true)); } private static ItemDrop Item(string name) { GameObject val = FindItemPrefab(name); if (!((Object)(object)val != (Object)null)) { return null; } return val.GetComponent<ItemDrop>(); } private static CraftingStation Station(string name) { GameObject prefab = PrefabManager.Instance.GetPrefab(name); if (!((Object)(object)prefab != (Object)null)) { return null; } return prefab.GetComponent<CraftingStation>(); } private static Requirement Req(ItemDrop item, int amount, int perLevel) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return new Requirement { m_resItem = item, m_amount = amount, m_amountPerLevel = perLevel }; } private void ApplyVisuals(GameObject sword, FireRig rig, float bladeStart) { Transform val = AttachRoot(sword); int axis = rig?.Span.Axis ?? (-1); Span span = Measure(val, axis); if (!span.Valid) { ((BaseUnityPlugin)this).Logger.LogWarning((object)(((Object)sword).name + ": could not measure the blade, skipping visuals.")); return; } float tipSign = TipSignFor(val, span, rig); if (GlowBlades.Value) { int num = GlowBladeOnly(val, span, tipSign, bladeStart, rig); Verbose(((Object)sword).name + ": blade glow parts " + num); } int num2 = rig?.Apply(val, span, bladeStart, tipSign) ?? AddTorchFallback(val, span); Verbose(((Object)sword).name + ": flame nodes attached " + num2); } internal static Material PickMaterial(GameObject root) { if ((Object)(object)root == (Object)null) { return null; } Material val = null; ParticleSystemRenderer[] componentsInChildren = root.GetComponentsInChildren<ParticleSystemRenderer>(true); foreach (ParticleSystemRenderer val2 in componentsInChildren) { if (!((Object)(object)((Renderer)val2).sharedMaterial == (Object)null)) { string text = ((Object)val2).name.ToLowerInvariant(); if (text.Contains("flame") || text.Contains("fire")) { return ((Renderer)val2).sharedMaterial; } if ((Object)(object)val == (Object)null) { val = ((Renderer)val2).sharedMaterial; } } } return val; } private void AddBladeComponent(GameObject sword, FireRig rig, float bladeStart) { //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_00b9: 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_00db: 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_00df: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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) Transform val = AttachRoot(sword); Span span = Measure(val, rig?.Span.Axis ?? (-1)); if (!span.Valid) { ((BaseUnityPlugin)this).Logger.LogWarning((object)(((Object)sword).name + ": could not measure the blade; no trail or throw for it.")); return; } float num = ((TipSignFor(val, span, rig) >= 0f) ? 1f : (-1f)); float num2 = span.Max - span.Min; float num3 = ((num > 0f) ? (span.Min + bladeStart * num2) : (span.Max - bladeStart * num2)); float num4 = ((num > 0f) ? span.Max : span.Min); Vector3 baseLocal = span.Center; ((Vector3)(ref baseLocal))[span.Axis] = num3; Vector3 tipLocal = span.Center; ((Vector3)(ref tipLocal))[span.Axis] = num4; if (TrailBlade(val, out var b, out var t)) { baseLocal = b; tipLocal = t; } FirebrandBlade firebrandBlade = ((Component)val).gameObject.GetComponent<FirebrandBlade>(); if ((Object)(object)firebrandBlade == (Object)null) { firebrandBlade = ((Component)val).gameObject.AddComponent<FirebrandBlade>(); } firebrandBlade.BaseLocal = baseLocal; firebrandBlade.TipLocal = tipLocal; } internal static bool TrailBlade(Transform attach, out Vector3 b, out Vector3 t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: 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) //IL_0075: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) b = Vector3.zero; t = Vector3.zero; if ((Object)(object)attach == (Object)null) { return false; } Transform val = attach.Find("equiped/trail/base"); Transform val2 = attach.Find("equiped/trail/tip"); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { return false; } Matrix4x4 worldToLocalMatrix = attach.worldToLocalMatrix; b = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(val.position); t = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(val2.position); Vector3 val3 = t - b; return ((Vector3)(ref val3)).sqrMagnitude > 0.0001f; } private static bool TrailAlongAxis(Vector3 b, Vector3 t, int axis) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = t - b; return Mathf.Abs(((Vector3)(ref val))[axis]) > 0.5f * ((Vector3)(ref val)).magnitude; } internal static float TipSignFor(Transform attach, Span span, FireRig rig) { //IL_000c: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (TrailBlade(attach, out var b, out var t) && TrailAlongAxis(b, t, span.Axis)) { Vector3 val = t - b; if (!(((Vector3)(ref val))[span.Axis] >= 0f)) { return -1f; } return 1f; } return rig?.TipSign ?? 1f; } private float DefaultBladeStart(GameObject sword, FireRig rig, SwordDef def) { //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) //IL_004b: 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_004d: 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) Transform val = AttachRoot(sword); Span span = Measure(val, rig?.Span.Axis ?? (-1)); if (span.Valid && TrailBlade(val, out var b, out var t) && TrailAlongAxis(b, t, span.Axis)) { Vector3 val2 = t - b; float num = ((((Vector3)(ref val2))[span.Axis] >= 0f) ? 1f : (-1f)); float num2 = span.Max - span.Min; float num3 = ((num >= 0f) ? ((((Vector3)(ref b))[span.Axis] - span.Min) / num2) : ((span.Max - ((Vector3)(ref b))[span.Axis]) / num2)); num3 = Mathf.Clamp(num3, 0.05f, 0.6f); Verbose("[FlameFit] " + ((Object)sword).name + " blade starts at " + num3.ToString("0.000") + " (from its trail nodes)"); return num3; } string name = ((Object)sword).name; float bladeStart = def.BladeStart; Verbose("[FlameFit] " + name + " has no usable trail nodes; using " + bladeStart); return def.BladeStart; } internal static bool NodeExcluded(Transform tr, Transform root) { string value = ExcludeNodeNames.Value; if (string.IsNullOrEmpty(value)) { return false; } Transform val = tr; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root) { string text = ((Object)val).name.ToLowerInvariant(); string[] array = value.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim().ToLowerInvariant(); if (text2.Length > 0 && text.Contains(text2)) { return true; } } val = val.parent; } return false; } internal static Vector3 BladeCenter(Transform attach, Span span, float tipSign, float bladeStart) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_012f: 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_0095: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00c3: 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_00f9: 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_0100: 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_0103: 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_010a: 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_00ef: 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_00f2: Unknown result type (might be due to invalid IL or missing references) float num = span.Max - span.Min; float num2 = ((tipSign >= 0f) ? (span.Min + bladeStart * num) : (span.Max - bladeStart * num)); bool flag = false; Vector3 val = Vector3.zero; Vector3 val2 = Vector3.zero; MeshFilter[] componentsInChildren = ((Component)attach).GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val3 in componentsInChildren) { Mesh sharedMesh = val3.sharedMesh; if ((Object)(object)sharedMesh == (Object)null || !sharedMesh.isReadable || (Object)(object)((Component)val3).GetComponentInParent<ParticleSystem>() != (Object)null) { continue; } Matrix4x4 val4 = attach.worldToLocalMatrix * ((Component)val3).transform.localToWorldMatrix; Vector3[] vertices = sharedMesh.vertices; foreach (Vector3 val5 in vertices) { Vector3 val6 = ((Matrix4x4)(ref val4)).MultiplyPoint3x4(val5); float num3 = ((Vector3)(ref val6))[span.Axis]; if (!((tipSign >= 0f) ? (num3 < num2) : (num3 > num2))) { if (!flag) { val = val6; val2 = val6; flag = true; } else { val = Vector3.Min(val, val6); val2 = Vector3.Max(val2, val6); } } } } if (!flag) { return span.Center; } return (val + val2) * 0.5f; } internal static Transform AttachRoot(GameObject sword) { Transform val = sword.transform.Find("attach"); if ((Object)(object)val == (Object)null) { val = sword.transform.Find("attach_skin"); } if ((Object)(object)val == (Object)null && sword.transform.childCount > 0) { val = sword.transform.GetChild(0); } if (!((Object)(object)val != (Object)null)) { return sword.transform; } return val; } internal static Span Measure(Transform root, int axis) { //IL_000c: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_017e: 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_0196: 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) //IL_01ae: 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_01b6: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) //IL_00c6: 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_00d0: 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_00d6: 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_00f4: 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_00e4: Unknown result type (might be due to invalid IL or missing references) Span result = default(Span); bool flag = false; Bounds val = default(Bounds); MeshFilter[] componentsInChildren = ((Component)root).GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val2 in componentsInChildren) { if ((Object)(object)val2.sharedMesh == (Object)null || (Object)(object)((Component)val2).GetComponentInParent<ParticleSystem>() != (Object)null) { continue; } Matrix4x4 val3 = root.worldToLocalMatrix * ((Component)val2).transform.localToWorldMatrix; Bounds bounds = val2.sharedMesh.bounds; for (int j = 0; j < 8; j++) { Vector3 val4 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3(((j & 1) == 0) ? (-1f) : 1f, ((j & 2) == 0) ? (-1f) : 1f, ((j & 4) == 0) ? (-1f) : 1f)); Vector3 val5 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(val4); if (!flag) { ((Bounds)(ref val))..ctor(val5, Vector3.zero); flag = true; } else { ((Bounds)(ref val)).Encapsulate(val5); } } } if (!flag) { return result; } Vector3 size = ((Bounds)(ref val)).size; if (axis < 0) { axis = 0; if (size.y > ((Vector3)(ref size))[axis]) { axis = 1; } if (size.z > ((Vector3)(ref size))[axis]) { axis = 2; } } if (((Vector3)(ref size))[axis] < 0.01f) { return result; } result.Valid = true; result.Axis = axis; Vector3 val6 = ((Bounds)(ref val)).min; result.Min = ((Vector3)(ref val6))[axis]; val6 = ((Bounds)(ref val)).max; result.Max = ((Vector3)(ref val6))[axis]; result.Center = ((Bounds)(ref val)).center; result.Size = size; return result; } private int GlowBladeOnly(Transform attach, Span span, float tipSign, float bladeStart, FireRig rig) { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) float num = span.Max - span.Min; float num2 = ((tipSign >= 0f) ? (span.Min + bladeStart * num) : (span.Max - bladeStart * num)); int num3 = 0; EmberMap emberMap = (EmberTexture.Value ? EmberSource.Get() : null); foreach (MeshFilter item in new List<MeshFilter>(((Component)attach).GetComponentsInChildren<MeshFilter>(true))) { MeshRenderer component = ((Component)item).GetComponent<MeshRenderer>(); Mesh val = item.sharedMesh; if ((Object)(object)component == (Object)null || (Object)(object)val == (Object)null || (Object)(object)((Component)item).GetComponentInParent<ParticleSystem>() != (Object)null) { continue; } if (!val.isReadable) { Mesh val2 = MeshReadback.MakeReadable(val); if ((Object)(object)val2 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Mesh " + ((Object)val).name + " is not readable and could not be read back; blade glow skipped for it.")); continue; } Verbose("[Readback] " + ((Object)val).name + ": rebuilt " + val2.vertexCount + " vertices, " + val2.subMeshCount + " submeshes"); val = val2; } Matrix4x4 val3 = attach.worldToLocalMatrix * ((Component)item).transform.localToWorldMatrix; Vector3[] vertices = val.vertices; float[] array = new float[vertices.Length]; for (int i = 0; i < vertices.Length; i++) { int num4 = i; Vector3 val4 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(vertices[i]); array[num4] = ((Vector3)(ref val4))[span.Axis]; } Mesh val5 = Object.Instantiate<Mesh>(val); Mesh val6 = Object.Instantiate<Mesh>(val); ((Object)val5).name = ((Object)val).name + "_firebrand_hilt"; ((Object)val6).name = ((Object)val).name + "_firebrand_blade"; ((Object)val5).hideFlags = (HideFlags)(((Object)val5).hideFlags | 0x20); ((Object)val6).hideFlags = (HideFlags)(((Object)val6).hideFlags | 0x20); bool flag = false; for (int j = 0; j < val.subMeshCount; j++) { int[] triangles = val.GetTriangles(j); List<int> list = new List<int>(); List<int> list2 = new List<int>(); for (int k = 0; k + 2 < triangles.Length; k += 3) { float num5 = (array[triangles[k]] + array[triangles[k + 1]] + array[triangles[k + 2]]) / 3f; List<int> obj = (((tipSign >= 0f) ? (num5 >= num2) : (num5 <= num2)) ? list2 : list); obj.Add(triangles[k]); obj.Add(triangles[k + 1]); obj.Add(triangles[k + 2]); } val5.SetTriangles(list, j); val6.SetTriangles(list2, j); if (list2.Count > 0) { flag = true; } } if (!flag) { continue; } item.sharedMesh = val5; GameObject val7 = new GameObject("FirebrandBladeGlow") { layer = ((Component)item).gameObject.layer }; val7.transform.SetParent(((Component)item).transform, false); val7.AddComponent<MeshFilter>().sharedMesh = val6; MeshRenderer val8 = val7.AddComponent<MeshRenderer>(); ((Renderer)val8).shadowCastingMode = ((Renderer)component).shadowCastingMode; ((Renderer)val8).receiveShadows = ((Renderer)component).receiveShadows; Material[] sharedMaterials = ((Renderer)component).sharedMaterials; Material[] array2 = (Material[])(object)new Material[sharedMaterials.Length]; Color val9 = new Color(1f, 0.34f, 0.07f) * GlowIntensity.Value; Color baseGlow = val9 * 0.5f; for (int l = 0; l < sharedMaterials.Length; l++) { if ((Object)(object)sharedMaterials[l] == (Object)null) { continue; } Material val10 = new Material(sharedMaterials[l]); ((Object)val10).hideFlags = (HideFlags)(((Object)val10).hideFlags | 0x20); val10.EnableKeyword("_EMISSION"); bool flag2 = false; if (emberMap != null && l < val6.subMeshCount && val10.HasProperty("_EmissionMap")) { Texture2D val11 = BladeBlend.BuildEmission(sharedMaterials[l].mainTexture, val6, l, emberMap, baseGlow, EmberIntensity.Value); if ((Object)(object)val11 != (Object)null) { val10.SetTexture("_EmissionMap", (Texture)(object)val11); if (val10.HasProperty("_EmissionColor")) { val10.SetColor("_EmissionColor", Color.white); } flag2 = true; } } if (!flag2 && val10.HasProperty("_EmissionColor")) { val10.SetColor("_EmissionColor", val9); } if (emberMap != null) { Verbose("[Ember] " + ((Object)val).name + " material " + l + " (" + ((Object)sharedMaterials[l]).name + "): " + (flag2 ? "ember cracks applied" : "no emission map on this shader, using the even tint")); } if (BladeTextureBlend.Value > 0f && rig != null && rig.Blade != null && l < val6.subMeshCount) { Texture2D val12 = BladeBlend.Blend(sharedMaterials[l].mainTexture, val6, l, rig.Blade, BladeTextureBlend.Value); if ((Object)(object)val12 != (Object)null) { val10.mainTexture = (Texture)(object)val12; } } array2[l] = val10; } ((Renderer)val8).sharedMaterials = array2; num3++; } return num3; } private int AddTorchFallback(Transform attach, Span span) { //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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00cd: 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) GameObject prefab = PrefabManager.Instance.GetPrefab("Torch"); if ((Object)(object)prefab == (Object)null) { return 0; } int num = 0; ParticleSystem[] componentsInChildren = prefab.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { string text = ((Object)val).name.ToLowerInvariant(); if (text.Contains("flame") || text.Contains("fire")) { GameObject obj = Object.Instantiate<GameObject>(((Component)val).gameObject, attach, false); Vector3 center = span.Center; ((Vector3)(ref center))[span.Axis] = Mathf.Lerp(span.Min, span.Max, 0.45f + 0.15f * (float)num); obj.transform.localPosition = center; obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = Vector3.one * 0.6f * FlameScale.Value; obj.SetActive(true); num++; if (num >= 3) { break; } } } return num; } private void BindSecondary() { SecondaryPriority = ((BaseUnityPlugin)this).Config.Bind<bool>("Secondary", "PriorityOverOtherMods", true, "While a Firebrand sword is held, the secondary attack button (middle mouse) always swings the sword's own secondary attack. Other mods' special attacks that take over that button (NorseDemigods' Crush, Ice Shards and so on) are skipped. Off = those mods may take it over, as before."); } private void BindShields() { ShieldEmberTexture = ((BaseUnityPlugin)this).Config.Bind<bool>("Shields", "EmberTexture", true, "Glowing ember cracks (the same pattern as on the swords) across the shield you carry while a Firebrand sword is held. Off = plain shields."); ShieldEmberIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Shields", "EmberIntensity", 0.7f, "How brightly the ember cracks glow on shields."); ShieldGlowIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Shields", "GlowIntensity", 0.15f, "A faint even heat under the cracks. 0 = none."); ShieldEmberTiles = ((BaseUnityPlugin)this).Config.Bind<float>("Shields", "EmberTiles", 5f, "How many crack strips fit across the shield. Higher = finer, more repeated cracks."); ShieldResize = ((BaseUnityPlugin)this).Config.Bind<bool>("Shields", "ResizeRoundShields", true, "Bring all round shields (round shield, bucklers, banded, ...) to one size between the Silver and the Banded shield, always, whatever you hold. Takes effect on the next start of the game."); ShieldSizeBetween = ((BaseUnityPlugin)this).Config.Bind<float>("Shields", "RoundShieldSize", 0.75f, "Where that size sits: 0 = as big as the Silver shield, 1 = as big as the Banded shield, 0.75 = three quarters of the way to Banded. Takes effect on the next start of the game."); ShieldBackOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Shields", "BackDistance", 0.09f, "How far a shield carried on your back sits behind your back, in meters, so it clears your cape. Raise it if it still clips. Changes apply live."); ShieldBackLift = ((BaseUnityPlugin)this).Config.Bind<float>("Shields", "BackLift", 0f, "Raise (+) or lower (-) the shield on your back, in meters. Changes apply live."); ShieldBackSide = ((BaseUnityPlugin)this).Config.Bind<float>("Shields", "BackSide", 0f, "Move the shield on your back to your right (+) or left (-), in meters. Changes apply live."); ShieldFireOnBlock = ((BaseUnityPlugin)this).Config.Bind<bool>("Shields", "FireOnBlock", true, "Blocking an attack with a shield while a Firebrand sword is held burns the attacker a little. Only affects melee attackers close to you. Off = the shield does nothing extra."); ShieldFireRatio = ((BaseUnityPlugin)this).Config.Bind<float>("Shields", "FireOnBlockRatio", 0.2f, "Fire damage dealt back, as a fraction of the damage of the attack you blocked. 0 = none."); ShieldFireMax = ((BaseUnityPlugin)this).Config.Bind<float>("Shields", "FireOnBlockMax", 25f, "The most fire damage one block can deal back."); } private static float FaceSize(GameObject prefab, out float roundness) { //IL_0034: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) roundness = 0f; if ((Object)(object)prefab == (Object)null) { return 0f; } Transform val = AttachRoot(prefab); Span span = Measure(val, -1); if (!span.Valid) { return 0f; } Vector3 lossyScale = val.lossyScale; float[] array = new float[3] { Mathf.Abs(span.Size.x * lossyScale.x), Mathf.Abs(span.Size.y * lossyScale.y), Mathf.Abs(span.Size.z * lossyScale.z) }; Array.Sort(array); if (array[2] < 0.01f || array[1] < 0.01f) { return 0f; } roundness = array[1] / array[2]; return Mathf.Sqrt(array[2] * array[1]); } } internal static class BurnFlames { private static readonly List<GameObject> templates = new List<GameObject>(); private static Material simpleMaterial; private static Texture2D simpleTexture; private static GameObject smokeTemplate; private static Material smokeMaterial; private static Texture2D smokeTexture; internal static bool Available { get { if (templates.Count <= 0) { return (Object)(object)Plugin.FlameMaterial != (Object)null; } return true; } } internal static void Capture(GameObject dyrnwyn, GameObject torch) { templates.Clear(); int num = Collect(dyrnwyn, "Dyrnwyn"); if (num == 0) { num = Collect(torch, "the torch"); } if (num == 0) { Plugin.Log.LogInfo((object)"[Burn] no flame particles found to copy; burning enemies will use a plain flame sprite"); } try { CaptureSmoke(dyrnwyn, torch); } catch (Exception ex) { Plugin.Verbose("[Burn] could not look for smoke particles: " + ex.GetType().Name + ": " + ex.Message); } } private static void CaptureSmoke(GameObject dyrnwyn, GameObject torch) { smokeTemplate = null; List<GameObject> list = new List<GameObject> { dyrnwyn, torch }; string[] array = new string[3] { "fire_pit", "hearth", "piece_groundtorch" }; foreach (string text in array) { GameObject prefab = PrefabManager.Instance.GetPrefab(text); if ((Object)(object)prefab != (Object)null) { list.Add(prefab); } } foreach (GameObject item in list) { if ((Object)(object)item == (Object)null) { continue; } ParticleSystem[] componentsInChildren = item.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { string text2 = ((Object)val).name.ToLowerInvariant(); if (text2.Contains("smoke") && !text2.Contains("spark")) { smokeTemplate = ((Component)val).gameObject; ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>(); Plugin.Verbose("[Burn] smoke particles from " + ((Object)item).name + ": " + ((Object)val).name + " material=" + (((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).sharedMaterial != (Object)null) ? ((Object)((Renderer)component).sharedMaterial).name : "?")); return; } } } Plugin.Verbose("[Burn] no smoke particles found to copy; the leap's smoke will be drawn from a plain puff sprite"); } private static bool Skipped(string lowerName) { if (lowerName.Contains("smoke") || lowerName.Contains("spark") || lowerName.Contains("ember") || lowerName.Contains("trail") || lowerName.Contains("glow") || lowerName.Contains("light")) { return true; } string text = ((Plugin.ExcludeParticleNames != null) ? Plugin.ExcludeParticleNames.Value : null); if (string.IsNullOrEmpty(text)) { return false; } string[] array = text.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim().ToLowerInvariant(); if (text2.Length > 0 && lowerName.Contains(text2)) { return true; } } return false; } private static int Collect(GameObject root, string label) { //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) //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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null) { return 0; } int num = 0; ParticleSystem[] componentsInChildren = root.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { string text = ((Object)val).name.ToLowerInvariant(); if ((!text.Contains("flame") && !text.Contains("fire")) || Skipped(text)) { continue; } bool flag = false; foreach (GameObject template in templates) { if (((Component)val).transform.IsChildOf(template.transform)) { flag = true; break; } } if (!flag) { templates.Add(((Component)val).gameObject); num++; MainModule main = val.main; EmissionModule emission = val.emission; ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>(); string[] obj = new string[14] { "[Burn] flame particles from ", label, ": ", ((Object)val).name, " size=", null, null, null, null, null, null, null, null, null }; MinMaxCurve val2 = ((MainModule)(ref main)).startSize; obj[5] = ((MinMaxCurve)(ref val2)).constantMax.ToString(); obj[6] = " rate="; val2 = ((EmissionModule)(ref emission)).rateOverTime; obj[7] = ((MinMaxCurve)(ref val2)).constantMax.ToString(); obj[8] = " lifetime="; val2 = ((MainModule)(ref main)).startLifetime; obj[9] = ((MinMaxCurve)(ref val2)).constantMax.ToString(); obj[10] = " render="; obj[11] = (((Object)(object)component != (Object)null) ? ((object)component.renderMode/*cast due to .constrained prefix*/).ToString() : "?"); obj[12] = " material="; obj[13] = (((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).sharedMaterial != (Object)null) ? ((Object)((Renderer)component).sharedMaterial).name : "?"); Plugin.Verbose(string.Concat(obj)); if (num >= 2) { break; } } } return num; } internal static List<ParticleSystem> Build(Transform parent, Vector3 size) { //IL_0005: 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_005c: 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_007a: Unknown result type (might be due to invalid IL or missing references) float flame = Mathf.Clamp(0.4f * size.y, 0.3f, 1.8f) * Mathf.Max(0.1f, Plugin.BurnFlameSize.Value); float rate = Mathf.Clamp(((Vector3)(ref size)).magnitude / 1.2f, 0.7f, 4f); Vector3 box = default(Vector3); ((Vector3)(ref box))..ctor(size.x * 0.7f, size.z * 0.7f, size.y * 0.7f); return Dress(parent, box, flame, rate, allowSimple: true); } internal static List<ParticleSystem> BuildTrail(Transform parent, float width, float height, float flame, float rate) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return Dress(parent, new Vector3(width, width, height), flame, rate, allowSimple: true); } internal static ParticleSystem BuildSmoke(Transform parent, float size, float rate) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) ParticleSystem val = null; if ((Object)(object)smokeTemplate != (Object)null) { GameObject val2 = Object.Instantiate<GameObject>(smokeTemplate, parent, false); ((Object)val2).name = "FirebrandSmoke_" + ((Object)smokeTemplate).name; va