Decompiled source of Drago Survival v1.0.7
plugins/kg_bin.dll
Decompiled 2 months agousing System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("kg_bin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("kg_bin")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("317450EF-AEB9-4488-9E0C-D29C6A5E8CFD")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace kg_bin; [BepInPlugin("kg_bin", "kg_bin", "1.0.0")] public class kg_bin : BaseUnityPlugin { [HarmonyPatch(typeof(AudioMan), "Awake")] private static class AudioMan_Awake_Patch { private static void Postfix(AudioMan __instance) { Explosion.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup; } } [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class ZNetScene_Awake_Patch { private static void Postfix(ZNetScene __instance) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown __instance.m_prefabs.Add(Bin); __instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)Bin).name), Bin); PieceTable buildPieces = __instance.GetPrefab("Hammer").GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces; Bin.GetComponent<Piece>().m_resources = (Requirement[])(object)new Requirement[2] { new Requirement { m_resItem = __instance.GetPrefab("Stone").GetComponent<ItemDrop>(), m_amount = 10, m_recover = true }, new Requirement { m_resItem = __instance.GetPrefab("SurtlingCore").GetComponent<ItemDrop>(), m_amount = 2, m_recover = true } }; if (!buildPieces.m_pieces.Contains(Bin)) { buildPieces.m_pieces.Add(Bin); } } } public class BinComponent : MonoBehaviour { private ZNetView _znv; private void Awake() { _znv = ((Component)this).GetComponentInParent<ZNetView>(); } private void OnTriggerEnter(Collider other) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (_znv.IsValid()) { ItemDrop val = (Object.op_Implicit((Object)(object)((Component)other).GetComponentInParent<ItemDrop>()) ? ((Component)other).GetComponentInParent<ItemDrop>() : ((Component)other).GetComponent<ItemDrop>()); if (Object.op_Implicit((Object)(object)val) && val.m_nview.IsValid() && val.m_nview.IsOwner()) { ZNetScene.instance.Destroy(((Component)val).gameObject); Object.Instantiate<GameObject>(Explosion, ((Component)val).transform.position, Quaternion.identity); } } } } private const string GUID = "kg_bin"; private const string PluginName = "kg_bin"; private const string PluginVersion = "1.0.0"; private static AssetBundle asset; private static GameObject Bin; private static GameObject Explosion; private void Awake() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) asset = GetAssetBundle("binremover"); Bin = asset.LoadAsset<GameObject>("ItemBinPlatformMod"); Bin.GetComponent<Piece>().m_name = "Magic Bin"; Bin.GetComponent<Piece>().m_description = "A magical bin that destroys all items thrown in it"; Explosion = asset.LoadAsset<GameObject>("Explosion_Small"); ((Component)Bin.transform.Find("sphere")).gameObject.AddComponent<BinComponent>(); new Harmony("kg_bin").PatchAll(); } private static AssetBundle GetAssetBundle(string filename) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename)); using Stream stream = executingAssembly.GetManifestResourceStream(name); return AssetBundle.LoadFromStream(stream); } }
plugins/RRRCore.dll
Decompiled 2 months 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.Collections.Specialized; using System.Data; using System.Diagnostics; using System.Dynamic; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Xml.Serialization; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using RRRCore.monster; using RRRCore.npc; using RRRCore.prefabs._0_2_0; using ServerSync; using TMPro; using UnityEngine; using fastJSON; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyDescription("Temporary version of RRRCore fixed for BogWitch patch.")] [assembly: AssemblyProduct("RRRCore")] [assembly: AssemblyTitle("RRRCore")] [assembly: ComVisible(false)] [assembly: Guid("8B7B1E6C-A2ED-4DAD-AF54-3B4E181B93AF")] [assembly: AssemblyFileVersion("3.1.6")] [assembly: AssemblyCopyright("Copyright © 2021 Alexander Strada")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.1.6.0")] [module: UnverifiableCode] namespace RRRCore { public static class Balance { public static class Tiers { public static List<string> ProgressionKeys = new string[5] { "defeated_eikthyr", "defeated_gdking", "defeated_bonemass", "defeated_dragon", "defeated_goblinking" }.ToList(); public static string ProgressionKey(int tier) { return ProgressionKeys[tier - 1]; } } public static class Enemy { public static float[] BasicDamageArray = new float[6] { 14f, 25f, 48f, 70f, 110f, 130f }; public static float[] BasicHealthArray = new float[6] { 30f, 50f, 100f, 150f, 200f, 300f }; public static float BasicDamage(int tier) { return BasicDamageArray[tier - 1]; } public static float BasicHealth(int tier) { return BasicHealthArray[tier - 1]; } } public static class Food { public static readonly List<string> T1 = new string[5] { "CookedMeat", "Honey", "Mushroom", "NeckTailGrilled", "Raspberry" }.ToList(); public static readonly List<string> T2 = new string[5] { "Blueberries", "Carrot", "CarrotSoup", "MushroomYellow", "QueensJam" }.ToList(); public static readonly List<string> T3 = new string[3] { "Sausages", "Turnip", "TurnipStew" }.ToList(); public static readonly List<string> T4 = new string[1] { "" }.ToList(); public static readonly List<string> T5 = new string[5] { "BloodPudding", "Bread", "Cloudberry", "CookedLoxMeat", "LoxPie" }.ToList(); private static readonly List<List<string>> Tiers = new List<List<string>>(new List<string>[5] { T1, T2, T3, T4, T5 }); public static List<string> Exotic = new string[4] { "FishCooked", "FishWraps", "SerpentMeatCooked", "SerpentStew" }.ToList(); public static List<string> AllAvailableAtTier(int tier) { List<string> allOut = new List<string>(); return AllAvailableAtTier(tier, ref allOut); } public static List<string> AllAvailableAtTier(int tier, ref List<string> allOut) { for (int i = 0; i < tier; i++) { allOut.AddRange(Tiers[i]); } return allOut; } } } public static class ConfigsMonsters { private const string SECTION_MONSTERSENABLED = "MonstersEnabled"; private static Dictionary<RRRMonsterName, RRRConfig<bool>> Config_MonstersEnabled; public static ConfigEntry<string> Config_ExportExistingPrefabs; public static bool IsMonsterEnabled(RRRMonsterName monsterName) { return Config_MonstersEnabled[monsterName].GetValue(); } internal static void Awake() { Config_MonstersEnabled = new Dictionary<RRRMonsterName, RRRConfig<bool>>(); foreach (RRRMonsterName item in Util.AllOf<RRRMonsterName>()) { Config_MonstersEnabled.Add(item, RRRConfig.Bind(Plugin.ConfigFile, "MonstersEnabled", item.ToString(), defaultValue: true, RRRMonsterNameData.GetDesc(item))); } Config_ExportExistingPrefabs = Plugin.ConfigFile.Bind<string>("PrefabTemplateExports", "PrefabNames", "", "Comma-separated list of monster prefab names to export templates to your config folder. Should be able to export prefabs from other mods, but will not export other custom prefabs made with this mod."); } public static void LateLoadPrefabsMonsters() { if (Util.IsGameInMainScene()) { if (IsMonsterEnabled(RRRMonsterName.RRR_GDThornweaver)) { GDThornweaver.LateLoadGdThornweaver(RRRPrefabLoader.Clone(GDThornweaver.OriginalName, RRRMonsterName.RRR_GDThornweaver.ToString())); } if (IsMonsterEnabled(RRRMonsterName.RRR_GhostVengeful)) { GhostVengeful.LateLoadGhostVengeful(RRRPrefabLoader.Clone(GhostVengeful.OriginalName, RRRMonsterName.RRR_GhostVengeful.ToString())); } if (IsMonsterEnabled(RRRMonsterName.RRR_TrollTosser)) { TrollTosser.LateLoadTrollTosser(RRRPrefabLoader.Clone(TrollTosser.OriginalName, RRRMonsterName.RRR_TrollTosser.ToString())); } if (IsMonsterEnabled(RRRMonsterName.RRR_Grig)) { Grig.LateLoadGrig(); } } } } public enum RRRMonsterName { RRR_GDThornweaver, RRR_GhostVengeful, RRR_TrollTosser, RRR_Grig } public static class RRRMonsterNameData { public static string GetDesc(RRRMonsterName name) { return name switch { RRRMonsterName.RRR_GDThornweaver => "Tier3 Greydwarf Shaman variant. Ranged Specialist.", RRRMonsterName.RRR_GhostVengeful => "Tier3 Ghost variant with increased speed and fire damage.", RRRMonsterName.RRR_TrollTosser => "Tier3 Troll variant. Ranged Specialist.", RRRMonsterName.RRR_Grig => "Tier4 fast melee hunter/chaser. High detection and can teleport to ambush prey.", _ => throw new ArgumentOutOfRangeException("name", name, null), }; } } public static class ConfigsNpcs { private class EnablePlayerAppearanceFeaturesForNpcs : RRRTogglePatch { public EnablePlayerAppearanceFeaturesForNpcs() { Description = "Normally, non-players cannot display Hair, Beards, Skin Color, or Hair Color. Only change if you know what you are doing."; } [HarmonyPatch(typeof(Humanoid), "SetupVisEquipment")] private static void Postfix(ref Humanoid __instance, VisEquipment visEq, bool isRagdoll) { //IL_005a: 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) if (Patch_EnablePlayerAppearanceFeaturesForNpcs.PatchIsEnabled() && visEq.m_isPlayer && !((Character)__instance).IsPlayer()) { visEq.SetBeardItem(__instance.m_beardItem); visEq.SetHairItem(__instance.m_hairItem); if (isRagdoll) { VisEquipment component = ((Component)__instance).gameObject.GetComponent<VisEquipment>(); visEq.SetSkinColor(component.m_skinColor); visEq.SetHairColor(component.m_hairColor); } } } } private const string SECTION_NPCSENABLED = "NpcsEnabled"; private const string SECTION_OPTIONAL = "Features"; private static RRRConfig<bool> Config_IsHostilesEnabled; public static RRRTogglePatch Patch_EnablePlayerAppearanceFeaturesForNpcs; public static bool IsHostilesEnabled() { return Config_IsHostilesEnabled.GetValue(); } internal static void Awake(Harmony harmony) { Config_IsHostilesEnabled = RRRConfig.Bind(Plugin.ConfigFile, "NpcsEnabled", "Hostiles", defaultValue: true, "An all-tiers set of hostile NPC mobs."); Patch_EnablePlayerAppearanceFeaturesForNpcs = new EnablePlayerAppearanceFeaturesForNpcs().Bind(harmony, Plugin.ConfigFile, "Features"); } public static void LateLoadPrefabsNpcs() { if (Util.IsGameInMainScene()) { Npc.MakePrefab(); if (IsHostilesEnabled()) { Hostile.MakePrefabs(); } } } } public static class RRRNpcName { public const string Npc = "RRR_NPC"; public const string Hostile = "RRR_Hostile"; public static string HostileTiered(int tier) { return string.Format("{0}_T{1}", "RRR_Hostile", tier); } } public class RRRConfig<T> { private readonly SyncedConfigEntry<T> syncedConfigEntry; public RRRConfig(ConfigFile config, string section, string key, T defaultValue, string description) { syncedConfigEntry = Plugin.ConfigSync.AddConfigEntry<T>(config.Bind<T>(section, key, defaultValue, description)); } public string Key() { return ((ConfigEntryBase)syncedConfigEntry.SourceConfig).Definition.Key; } public T GetValue() { return syncedConfigEntry.Value; } } public static class RRRConfig { public static RRRConfig<T> Bind<T>(ConfigFile config, string section, string key, T defaultValue, string description) { return new RRRConfig<T>(config, section, key, defaultValue, description); } } public static class RRRReplaceRefHandler { private const string TAG_REPLACE_REF = "_RRR_REPLACEREF_"; private const string TAG_REPLACE_PATH = "_RRR_REPLACEPATH_"; private const char PATH_DELIMITER = '@'; public static GameObject ProcessReplaceRefs(GameObject go) { MonoBehaviour[] componentsInChildren = go.GetComponentsInChildren<MonoBehaviour>(); foreach (MonoBehaviour val in componentsInChildren) { ReplaceRefAllEffectLists(val); ((CharacterDrop)(((val is CharacterDrop) ? val : null)?)).m_drops.ForEach(delegate(Drop d) { if (d.IsNotNull() && d.m_prefab.IsNotNull()) { d.m_prefab = TryReplaceRef(d.m_prefab); } }); ItemDrop val2 = (ItemDrop)(object)((val is ItemDrop) ? val : null); if (val2 != null) { ReplaceRefAllEffectLists(val2.m_itemData.m_shared); ReplaceRefAllEffectLists(val2.m_itemData.m_shared.m_attack); ReplaceRefAllEffectLists(val2.m_itemData.m_shared.m_secondaryAttack); } } return go; } private static void ReplaceRefAllEffectLists(object obj) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown FieldInfo[] fields = obj.GetType().GetFields(); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(EffectList)) { fieldInfo.SetValue(obj, ReplaceRefEffectList((EffectList)fieldInfo.GetValue(obj))); } } } private static EffectList ReplaceRefEffectList(this EffectList effectList) { for (int i = 0; i < effectList.m_effectPrefabs.Length; i++) { GameObject prefab = effectList.m_effectPrefabs[i].m_prefab; if ((Object)(object)prefab != (Object)null) { effectList.m_effectPrefabs[i].m_prefab = TryReplaceRef(prefab); } } return effectList; } private static GameObject TryReplaceRef(GameObject gameObject) { if (((Object)gameObject).name.StartsWith("_RRR_REPLACEREF_")) { return ReplaceRef(gameObject); } return ((Object)gameObject).name.StartsWith("_RRR_REPLACEPATH_") ? ReplacePath(gameObject) : gameObject; } private static GameObject ReplaceRef(GameObject replaceRef) { return GetRef(((Object)replaceRef).name.Substring("_RRR_REPLACEREF_".Length)); } private static GameObject ReplacePath(GameObject replaceRef) { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) string[] path = ((Object)replaceRef).name.Substring("_RRR_REPLACEPATH_".Length).Split(new char[1] { '@' }); if (path.Length != 4) { return null; } GameObject @ref = GetRef(path[0]); if ((Object)(object)@ref == (Object)null) { return null; } if (!(path[1] == "Humanoid")) { return null; } MonoBehaviour component = (MonoBehaviour)(object)@ref.GetComponent<Humanoid>(); FieldInfo fieldInfo = ((object)component).GetType().GetFields().First((FieldInfo fi) => fi.Name == path[2]); if ((object)fieldInfo == null || fieldInfo.FieldType != typeof(EffectList)) { return null; } int result; return int.TryParse(path[3], out result) ? ((EffectList)fieldInfo.GetValue(component)).m_effectPrefabs[result].m_prefab : null; } private static GameObject GetRef(string newName) { GameObject val = ZNetScene.instance.GetPrefab(newName) ?? ObjectDB.instance.GetItemPrefab(newName); if ((Object)(object)val != (Object)null) { return val; } Plugin.log.LogError((object)("Invalid ref '" + newName + "'")); return null; } internal static void TryFixSfxAudioMixerGroup(GameObject gameObject) { AudioSource component = gameObject.GetComponent<AudioSource>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.outputAudioMixerGroup != (Object)null)) { GameObject val = RRRPrefabLoader.FindName("sfx_neck_death"); if (val.IsNotNull()) { component.outputAudioMixerGroup = val.GetComponent<AudioSource>().outputAudioMixerGroup; } else { Plugin.log.LogWarning((object)"Couldn't find stock game sound to fix Audio Mixer Group."); } } } } public static class RRRMobItem { private static string MakeName(string ownerName, string weaponName, string ownerWeaponId) { return ownerName + "_" + weaponName + "_" + ownerWeaponId; } public static GameObject Get(string ownerName, string weaponName, int ownerWeaponId, float damage, string projectileName = null) { string newName = MakeName(ownerName, weaponName, ownerWeaponId.ToString()); bool alreadyExisted = false; GameObject val = RRRPrefabLoader.CloneRepeatable(ref alreadyExisted, weaponName, newName, regZns: true, regOdb: true); if (alreadyExisted) { return val; } ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { throw new NullReferenceException("No ItemDrop component in prefab: " + weaponName); } SharedData shared = component.m_itemData.m_shared; shared.m_damages.RetuneDamage(damage); if (projectileName.NonEmpty()) { shared.m_ammoType = ""; shared.m_aiAttackRange = 25f; shared.m_aiAttackRangeMin = 0f; shared.m_aiAttackMaxAngle = 10f; shared.m_attackForce = 15f; ((DamageTypes)(ref shared.m_damagesPerLevel)).Modify(0f); shared.m_attack.m_drawDurationMin = 0f; shared.m_attack.m_drawStaminaDrain = 20f; shared.m_attack.m_drawAnimationState = ""; shared.m_secondaryAttack.m_drawDurationMin = 0f; shared.m_secondaryAttack.m_drawStaminaDrain = 20f; shared.m_secondaryAttack.m_drawAnimationState = ""; shared.m_attack.m_speedFactor = 0f; shared.m_attack.m_speedFactorRotation = 0.5f; shared.m_attack.m_attackStartNoise = 20f; shared.m_attack.m_attackHitNoise = 30f; shared.m_attack.m_projectileVel = 30f; shared.m_attack.m_projectileVelMin = 2f; shared.m_attack.m_projectileAccuracy = 2f; shared.m_attack.m_attackProjectile = ZNetScene.instance.GetPrefab(projectileName); } return val; } public static GameObject GetNpcUnarmed(float damage) { string text = MakeName("RRR_NPC", "Unarmed", $"D{damage}"); bool alreadyExisted = false; GameObject val = RRRPrefabLoader.CloneRepeatable(ref alreadyExisted, ((Component)((Humanoid)ZNetScene.instance.GetPrefab("Player").GetComponent<Player>()).m_unarmedWeapon).gameObject, text, regZns: true, regOdb: true); if (alreadyExisted) { return val; } SharedData shared = val.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_name = text; shared.m_damages.RetuneDamage(damage); return val; } } public static class RRRCustomMobDB { private static List<string> LocalJsons = new List<string>(); private static List<RRRMobData> CustomMobs = new List<RRRMobData>(); private static Dictionary<string, RRRMobData> MobDataDict = new Dictionary<string, RRRMobData>(); private static Dictionary<string, Texture2D> TextureDict = new Dictionary<string, Texture2D>(); internal static List<GameObject> CustomMobPrefabs = new List<GameObject>(); internal static List<GameObject> CustomAttackPrefabs = new List<GameObject>(); internal static bool TryGetTexture(string customTexture, out Texture2D texture) { return TextureDict.TryGetValue(customTexture, out texture); } internal static RRRMobData GetMobData(string newPrefabName) { if (MobDataDict.TryGetValue(newPrefabName, out var value)) { return value; } Plugin.log.LogWarning((object)("Failed to find MobData for clone " + newPrefabName + ". This is highly unusual!")); return null; } internal static void MakePrefabs() { CustomMobs.Sort((RRRMobData data1, RRRMobData data2) => data1.sNewPrefabName.CompareTo(data2.sNewPrefabName)); foreach (RRRMobData customMob in CustomMobs) { GameObject val = customMob.Make(); if (val.IsNotNull()) { MobDataDict.Add(customMob.sNewPrefabName, customMob); CustomMobPrefabs.Add(val); } } foreach (GameObject customMobPrefab in CustomMobPrefabs) { Humanoid component = customMobPrefab.GetComponent<Humanoid>(); if (Object.op_Implicit((Object)(object)component)) { EffectData[] effectPrefabs = ((Character)component).m_hitEffects.m_effectPrefabs; foreach (EffectData effectData in effectPrefabs) { ProcessPlaceholders(effectData); } EffectData[] effectPrefabs2 = ((Character)component).m_deathEffects.m_effectPrefabs; foreach (EffectData effectData2 in effectPrefabs2) { ProcessPlaceholders(effectData2); } EffectData[] effectPrefabs3 = component.m_consumeItemEffects.m_effectPrefabs; foreach (EffectData effectData3 in effectPrefabs3) { ProcessPlaceholders(effectData3); } } BaseAI component2 = customMobPrefab.GetComponent<BaseAI>(); if (Object.op_Implicit((Object)(object)component2)) { EffectData[] effectPrefabs4 = component2.m_idleSound.m_effectPrefabs; foreach (EffectData effectData4 in effectPrefabs4) { ProcessPlaceholders(effectData4); } EffectData[] effectPrefabs5 = component2.m_alertedEffects.m_effectPrefabs; foreach (EffectData effectData5 in effectPrefabs5) { ProcessPlaceholders(effectData5); } } MonsterAI component3 = customMobPrefab.GetComponent<MonsterAI>(); if (Object.op_Implicit((Object)(object)component3)) { EffectData[] effectPrefabs6 = component3.m_wakeupEffects.m_effectPrefabs; foreach (EffectData effectData6 in effectPrefabs6) { ProcessPlaceholders(effectData6); } } } CustomMobPrefabs.Clear(); foreach (GameObject customAttackPrefab in CustomAttackPrefabs) { ItemDrop component4 = customAttackPrefab.GetComponent<ItemDrop>(); EffectData[] effectPrefabs7 = component4.m_itemData.m_shared.m_startEffect.m_effectPrefabs; foreach (EffectData effectData7 in effectPrefabs7) { ProcessPlaceholders(effectData7); } EffectData[] effectPrefabs8 = component4.m_itemData.m_shared.m_hitEffect.m_effectPrefabs; foreach (EffectData effectData8 in effectPrefabs8) { ProcessPlaceholders(effectData8); } EffectData[] effectPrefabs9 = component4.m_itemData.m_shared.m_triggerEffect.m_effectPrefabs; foreach (EffectData effectData9 in effectPrefabs9) { ProcessPlaceholders(effectData9); } } CustomAttackPrefabs.Clear(); } private static void ProcessPlaceholders(EffectData effectData) { string text = "_PLACEHOLDER_"; if ((Object)(object)effectData.m_prefab != (Object)null && ((Object)effectData.m_prefab).name.Contains(text)) { string originalName = ((Object)effectData.m_prefab).name.Substring(text.Length); Object.Destroy((Object)(object)effectData.m_prefab); effectData.m_prefab = RRRPrefabLoader.FindName(originalName); } } public static List<string> Serialize() { return CustomMobs.Select((RRRMobData c) => JSON.ToNiceJSON(c, Util.JsonParameters)).ToList(); } public static void Deserialize(List<string> serializedMobs) { CustomMobs.Clear(); MobDataDict.Clear(); for (int i = 0; i < serializedMobs.Count; i++) { string text = serializedMobs[i]; try { CustomMobs.Add(JSON.ToObject<RRRMobData>(text, Util.JsonParameters)); } catch (Exception ex) { LogDeserializationError(text, ex.Message); } } } public static void LoadLocalConfigs() { Plugin.ConfigFile.Reload(); string[] files = Directory.GetFiles(Paths.ConfigPath, "rrr*.custom.*.json", SearchOption.AllDirectories); foreach (string text in files) { if (!text.Contains("custom.Exported") && !text.Contains("custom.Example")) { LocalJsons.Add(File.ReadAllText(text)); } } Deserialize(LocalJsons); LocalJsons.Clear(); } public static void LoadLocalTextures() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown TextureDict.Clear(); string[] files = Directory.GetFiles(Paths.ConfigPath, "rrrtex.*.png", SearchOption.AllDirectories); foreach (string text in files) { string key = text.Remove(text.Length - 4).Substring(text.IndexOf("rrrtex") + 7); Texture2D val = new Texture2D(2, 2); byte[] array = File.ReadAllBytes(text); ImageConversion.LoadImage(val, array); TextureDict[key] = val; } } public static void DoExports() { if (ZNet.instance.IsServer() && !ZNet.instance.IsDedicated()) { DoNpcExports(); DoMonsterExports(); } } private static void DoNpcExports() { if (ZNet.instance.IsServer() && !ZNet.instance.IsDedicated()) { ExportToFile(ZNetScene.instance.GetPrefab("RRR_NPC"), "Example", isNpc: true); } } private static void DoMonsterExports() { if (!ZNet.instance.IsServer() || ZNet.instance.IsDedicated()) { return; } string value = ConfigsMonsters.Config_ExportExistingPrefabs.Value; char[] separator = new char[1] { ',' }; foreach (string item in (from s in value.Split(separator).ToList() select s.Trim() into s where !Utility.IsNullOrWhiteSpace(s) select s).ToList()) { GameObject prefab = ZNetScene.instance.GetPrefab(item); if (prefab.IsNotNull()) { ExportToFile(prefab, "Exported" + item); } } ConfigsMonsters.Config_ExportExistingPrefabs.Value = ""; } private static void ExportToFile(GameObject prefab, string newName, bool isNpc = false) { if (ZNet.instance.IsServer() && !ZNet.instance.IsDedicated()) { RRRMobData rRRMobData = RRRMobData.Convert(prefab); rRRMobData.sOriginalPrefabName = (isNpc ? "RRR_NPC" : ((Object)prefab).name); rRRMobData.sNewPrefabName = newName; File.WriteAllText(Path.Combine(Paths.ConfigPath, (isNpc ? "rrrnpcs" : "rrrmonsters") + ".custom." + newName + ".json"), JSON.ToNiceJSON(rRRMobData, Util.JsonParameters)); } } private static void LogDeserializationError(string mobJson, string exceptionMessage) { Plugin.log.LogError((object)"--------------------------------------------------------------"); Plugin.log.LogError((object)"Invalid custom prefab JSON. First 2 lines of broken file:"); using (StringReader stringReader = new StringReader(mobJson)) { stringReader.ReadLine(); Plugin.log.LogError((object)stringReader.ReadLine()); Plugin.log.LogError((object)stringReader.ReadLine()); } Plugin.log.LogError((object)"--------------------------------------------------------------"); Plugin.log.LogError((object)"If given, number points to exact character index of error:"); using (StringReader stringReader2 = new StringReader(exceptionMessage)) { Plugin.log.LogError((object)(" " + stringReader2.ReadLine())); } Plugin.log.LogError((object)"--------------------------------------------------------------"); } } public class RRRMobCustomization : MonoBehaviour { private Humanoid humanoid; private MonsterAI monsterAI; private RRRMobData mobData; public string MobDataNewPrefabName; public string FullPrefabName; private void Awake() { humanoid = ((Component)this).GetComponent<Humanoid>(); monsterAI = ((Component)this).GetComponent<MonsterAI>(); mobData = RRRCustomMobDB.GetMobData(MobDataNewPrefabName); } private void Start() { if (mobData.IsNotNull() && mobData.Category_Special.IsNotNull()) { if (mobData.Category_Special.bCanTame || mobData.Category_Special.bAlwaysTame) { SetupTameable(); } if (mobData.Category_Special.bSfxNoAlert) { RemoveSfx(ref ((BaseAI)monsterAI).m_alertedEffects.m_effectPrefabs); } if (mobData.Category_Special.bSfxNoIdle) { RemoveSfx(ref ((BaseAI)monsterAI).m_idleSound.m_effectPrefabs); } if (mobData.Category_Special.bSfxNoHit) { RemoveSfx(ref ((Character)humanoid).m_hitEffects.m_effectPrefabs); } if (mobData.Category_Special.bSfxNoDeath) { RemoveSfx(ref ((Character)humanoid).m_deathEffects.m_effectPrefabs); } } } private void SetupTameable() { Tameable val = ((Component)this).gameObject.AddComponent<Tameable>(); GameObject prefab = ZNetScene.instance.GetPrefab("Wolf"); Tameable component = prefab.GetComponent<Tameable>(); val.m_fedDuration = component.m_fedDuration; val.m_tamingTime = component.m_tamingTime; bool valueOrDefault = mobData.Category_Special.bFxNoTame.GetValueOrDefault(false); if (!valueOrDefault) { val.m_tamedEffect = component.m_tamedEffect; val.m_sootheEffect = component.m_sootheEffect; val.m_petEffect = component.m_petEffect; } val.m_commandable = mobData.Category_Special.bCommandableWhenTame; if (mobData.Category_Special.bCanProcreateWhenTame) { Procreation val2 = ((Component)this).gameObject.AddComponent<Procreation>(); Procreation component2 = prefab.GetComponent<Procreation>(); val2.m_updateInterval = component2.m_updateInterval; val2.m_pregnancyChance = component2.m_pregnancyChance; val2.m_pregnancyDuration = component2.m_pregnancyDuration; val2.m_offspring = ZNetScene.instance.GetPrefab(FullPrefabName); if (!valueOrDefault) { val2.m_birthEffects = component2.m_birthEffects; val2.m_loveEffects = component2.m_loveEffects; } } if (mobData.Category_Special.bAlwaysTame) { val.Tame(); } } private static void RemoveSfx(ref EffectData[] data) { data = data.Where((EffectData d) => (Object)(object)d.m_prefab.GetComponent<ZSFX>() == (Object)null).ToArray(); } } public static class RRRModCompat { public static class Guids { public const string CustomRaids = "asharppen.valheim.custom_raids"; } public const string ConfigSection = "zOtherMods"; } [BepInPlugin("com.alexanderstrada.rrrcore", "RRRCore", "3.1.6")] [HarmonyPatch] public class Plugin : BaseUnityPlugin { public const string GUID = "com.alexanderstrada.rrrcore"; public const string NAME = "RRRCore"; public const string VERSION = "3.1.6"; internal static AssetBundle MonstersAssets; internal static ManualLogSource log; internal static ConfigFile ConfigFile; internal static ConfigSync ConfigSync; internal static CustomSyncedValue<List<string>> Config_CustomMobs; internal static bool MissingTextureWarningShown; private void Awake() { log = ((BaseUnityPlugin)this).Logger; ConfigFile = ((BaseUnityPlugin)this).Config; WarnAboutDeprecatedSubmods(); ConfigSync = new ConfigSync("com.alexanderstrada.rrrcore") { DisplayName = "RRRCore", CurrentVersion = "3.1.6", MinimumRequiredVersion = "3.1.6" }; Config_CustomMobs = new CustomSyncedValue<List<string>>(ConfigSync, "Config_CustomMobs"); ApplyPatches(); LoadMonsters(); LoadNpcs(); } private static void ApplyPatches() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown Harmony val = new Harmony("com.alexanderstrada.rrrcore"); MethodInfo methodInfo = AccessTools.Method(typeof(ObjectDB), "Awake", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(ObjectDB), "CopyOtherDB", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(Game), "RequestRespawn", (Type[])null, (Type[])null); MethodInfo methodInfo4 = AccessTools.Method(typeof(Plugin), "EarlyLoad", (Type[])null, (Type[])null); val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo4, 800, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(methodInfo4, 800, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo5 = AccessTools.Method(typeof(Plugin), "LateLoadServer", (Type[])null, (Type[])null); MethodInfo methodInfo6 = AccessTools.Method(typeof(Plugin), "LateLoadClient", (Type[])null, (Type[])null); val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo5, 0, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(methodInfo6, 800, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void EarlyLoad() { Grig.EarlyLoadGrig(); } private static void LateLoadServer() { if (Util.IsGameInMainScene() && ZNet.instance.IsServer()) { RRRCustomMobDB.LoadLocalTextures(); RRRCustomMobDB.LoadLocalConfigs(); RRRPrefabLoader.Load(); Config_CustomMobs.Value = RRRCustomMobDB.Serialize(); } } private static void LateLoadClient() { if (Game.instance.m_firstSpawn && Util.IsGameInMainScene() && !ZNet.instance.IsServer()) { MissingTextureWarningShown = false; RRRCustomMobDB.LoadLocalTextures(); if (Config_CustomMobs.Value == null) { log.LogWarning((object)"Did not receive configs from ServerSync in time! This is bad! Connection issues, or extreme transfer size?"); RRRCustomMobDB.LoadLocalConfigs(); } else { RRRCustomMobDB.Deserialize(Config_CustomMobs.Value); } RRRPrefabLoader.Load(); } } private void LoadMonsters() { ConfigsMonsters.Awake(); MonstersAssets = Util.LoadAssetBundle(typeof(Plugin), "rrrmonstersassets"); RRRPrefabLoader.LateLoadPrefabs += ConfigsMonsters.LateLoadPrefabsMonsters; } private void LoadNpcs() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown ConfigsNpcs.Awake(new Harmony("com.alexanderstrada.rrrcore")); RRRPrefabLoader.LateLoadPrefabs += ConfigsNpcs.LateLoadPrefabsNpcs; } private static void WarnAboutDeprecatedSubmods() { string[] files = Directory.GetFiles(Paths.PluginPath, "*.dll"); foreach (string path in files) { string text = Path.GetFileNameWithoutExtension(path).ToLower(); if (text.Contains("rrrmonsters") || text.Contains("rrrnpcs")) { string text2 = "HEY, LISTEN! RRR Monsters and NPCs have both been combined into RRR Core! You need to delete RRRNpcs.dll and RRRMonsters.dll from your Bepinex/Plugins folder, or you will get a big nasty red error message for each one (see nasty red error message below!)"; string text3 = "Found " + text + " in your plugins folder! Delete it!"; log.LogError((object)"-------------------------"); log.LogError((object)text2); log.LogWarning((object)text2); log.LogError((object)text3); log.LogWarning((object)text3); log.LogError((object)"-------------------------"); } } } } [RequireComponent(typeof(CharacterDrop))] public class RRRCustomDrop : MonoBehaviour { public List<string> options; public float chance; public float chanceMod; public int min; public int max; public RRRCustomDrop Config(List<string> setOptions, float setChance = 1f, float setChanceMod = 1f, int setMin = 0, int setMax = 1) { options = setOptions; chance = setChance; chanceMod = setChanceMod; min = setMin; max = setMax; return this; } private void Start() { //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_0089: Expected O, but got Unknown CharacterDrop component = ((Component)this).gameObject.GetComponent<CharacterDrop>(); int num = min; for (int i = 0; i < max - min; i++) { if ((double)Random.value <= (double)chance * (double)Mathf.Pow(chanceMod, (float)i)) { num++; } } for (int j = 0; j < num; j++) { string text = options.RandomMember(); Drop item = new Drop { m_prefab = ZNetScene.instance.GetPrefab(text) }; component.m_drops.Add(item); } Object.Destroy((Object)(object)this); } } public class RRRNpcCustomization : MonoBehaviour { public bool IsFemale; public bool IsRandomGender; public bool IsNoBeardIfFemale; public List<string> BeardItems; public List<string> HairItems; public Color SkinColorMin; public Color SkinColorMax; public Color HairColorMin; public Color HairColorMax; public float HairValueMin; public float HairValueMax; private void Awake() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00f1: Unknown result type (might be due to invalid IL or missing references) Humanoid component = ((Component)this).gameObject.GetComponent<Humanoid>(); VisEquipment component2 = ((Component)this).gameObject.GetComponent<VisEquipment>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component2 == (Object)null)) { int num = (IsRandomGender ? Mathf.RoundToInt(Random.value) : (IsFemale ? 1 : 0)); component2.SetModel(num); if (num == 0 || !IsNoBeardIfFemale) { component.m_beardItem = BeardItems.RandomMember(); } component.m_hairItem = HairItems.RandomMember(); Color val = Color.Lerp(SkinColorMin, SkinColorMax, Random.value); component2.SetSkinColor(Utils.ColorToVec3(val)); Color val2 = Color.Lerp(HairColorMin, HairColorMax, Random.value) * Mathf.Lerp(HairValueMin, HairValueMax, Random.value); component2.SetHairColor(Utils.ColorToVec3(val2)); component.SetupEquipment(); } } } public static class RRRPluginGuids { public static string FromName(string pluginName) { if (pluginName == "RRRCore") { return "com.alexanderstrada.rrrcore"; } throw new Exception("PluginName " + pluginName + " had no corresponding GUID."); } } public static class RRRPluginNames { public const string RRRCore = "RRRCore"; public static string FromGuid(string pluginGuid) { if (pluginGuid == "com.alexanderstrada.rrrcore") { return "RRRCore"; } throw new Exception("PluginGuid " + pluginGuid + " had no corresponding name."); } } public static class RRRPrefabLoader { public delegate void LateLoadPrefabsDelegate(); public delegate void LateLoadCompleteDelegate(); private const string ParentName = "RRRCore_StasisParentLate"; private static readonly List<GameObject> PrefabsToZns; private static readonly List<GameObject> PrefabsToOdb; private static bool BuildComplete; public static GameObject StasisParent { get; private set; } public static event LateLoadPrefabsDelegate LateLoadPrefabs; public static event LateLoadCompleteDelegate LateLoadComplete; static RRRPrefabLoader() { PrefabsToZns = new List<GameObject>(); PrefabsToOdb = new List<GameObject>(); EmptySetup(); } internal static void EmptySetup() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if ((Object)(object)StasisParent != (Object)null) { Object.Destroy((Object)(object)StasisParent); } StasisParent = new GameObject("RRRCore_StasisParentLate"); Object.DontDestroyOnLoad((Object)(object)StasisParent); StasisParent.SetActive(false); PrefabsToZns.Clear(); PrefabsToOdb.Clear(); BuildComplete = false; } internal static GameObject Remove(string prefabName) { GameObject result = null; foreach (GameObject prefabsToZn in PrefabsToZns) { if (((Object)prefabsToZn).name == prefabName) { result = prefabsToZn; PrefabsToZns.Remove(prefabsToZn); break; } } foreach (GameObject item in PrefabsToOdb) { if (((Object)item).name == prefabName) { result = item; PrefabsToOdb.Remove(item); break; } } return result; } internal static void Load() { EmptySetup(); RRRPrefabLoader.LateLoadPrefabs?.Invoke(); if (Util.IsGameInMainScene()) { RRRCustomMobDB.MakePrefabs(); foreach (GameObject prefabsToZn in PrefabsToZns) { int stableHashCode = StringExtensionMethods.GetStableHashCode(((Object)prefabsToZn).name); ZNetScene.instance.m_prefabs.Add(prefabsToZn); ZNetScene.instance.m_namedPrefabs.Add(stableHashCode, prefabsToZn); } if (ZNet.instance.IsServer() && !ZNet.instance.IsDedicated()) { RRRCustomMobDB.DoExports(); } } foreach (GameObject item in PrefabsToOdb) { ObjectDB.instance.m_items.Add(item); } if (PrefabsToOdb.NonEmpty()) { ObjectDB.instance.UpdateRegisters(); } PrefabsToZns.Clear(); PrefabsToOdb.Clear(); BuildComplete = true; RRRPrefabLoader.LateLoadComplete?.Invoke(); } public static void Add(GameObject gameObject, bool regZns = true, bool regOdb = false) { if (BuildComplete) { throw new Exception("Tried to call Add after Build. Object name: '" + ((Object)gameObject).name + "'"); } if (FindName(((Object)gameObject).name).IsNotNull()) { throw new Exception("There is already a prefab named: '" + ((Object)gameObject).name + "'"); } RRRReplaceRefHandler.TryFixSfxAudioMixerGroup(gameObject); if (regZns) { PrefabsToZns.Add(gameObject); } if (regOdb) { PrefabsToOdb.Add(gameObject); } } public static GameObject Clone(string originalName, string newName, bool regZns = true, bool regOdb = false) { if (BuildComplete) { throw new Exception("Tried to call Clone after Build. NewName: '" + newName + "'"); } GameObject val = FindName(originalName); if ((Object)(object)val == (Object)null) { throw new NullReferenceException("No such original prefab: " + originalName); } return Clone(val, newName, regZns, regOdb); } public static GameObject Clone(GameObject originalPrefab, string newName, bool regZns = true, bool regOdb = false) { if (BuildComplete) { throw new Exception("Tried to call Clone after Build. NewName: '" + newName + "'"); } if (PrefabsToZns.ExistsName(newName) || Object.op_Implicit((Object)(object)ZNetScene.instance.GetPrefab(newName)) || PrefabsToOdb.ExistsName(newName) || (Object.op_Implicit((Object)(object)ObjectDB.instance.GetItemPrefab(newName)) ? true : false)) { throw new Exception("Tried to Clone prefab, but name already exists: " + newName); } GameObject val = Object.Instantiate<GameObject>(originalPrefab, StasisParent.transform); ((Object)val).name = newName; if (regZns) { PrefabsToZns.Add(val); } if (regOdb) { PrefabsToOdb.Add(val); } return val; } public static GameObject CloneRepeatable(ref bool alreadyExisted, string originalName, string newName, bool regZns = true, bool regOdb = false) { if (BuildComplete) { throw new Exception("Tried to call CloneRepeatable after Build. NewName: '" + newName + "'"); } GameObject val = FindName(originalName); if ((Object)(object)val == (Object)null) { throw new NullReferenceException("No such original prefab: " + originalName); } return CloneRepeatable(ref alreadyExisted, val, newName, regZns, regOdb); } public static GameObject CloneRepeatable(ref bool alreadyExisted, GameObject originalPrefab, string newName, bool regZns = true, bool regOdb = false) { if (BuildComplete) { throw new Exception("Tried to call CloneRepeatable after Build. NewName: '" + newName + "'"); } for (int i = 0; i < StasisParent.transform.childCount; i++) { GameObject gameObject = ((Component)StasisParent.transform.GetChild(i)).gameObject; if (((Object)gameObject).name == newName) { alreadyExisted = true; return gameObject; } } alreadyExisted = false; return Clone(originalPrefab, newName, regZns, regOdb); } internal static GameObject FindName(string originalName) { GameObject val = ZNetScene.instance.GetPrefab(originalName); if ((Object)(object)val == (Object)null) { val = ObjectDB.instance.GetItemPrefab(originalName); } if ((Object)(object)val == (Object)null) { val = PrefabsToZns.Find((GameObject go) => ((Object)go).name == originalName); } if ((Object)(object)val == (Object)null) { val = PrefabsToOdb.Find((GameObject go) => ((Object)go).name == originalName); } return val; } } public class RRRTogglePatch { public const string Warn = "Only change if you know what you are doing."; public const string DefaultDesc = "<Description Unspecified>"; public string Description = "<Description Unspecified>"; private RRRConfig<bool> LocalValue; public bool PatchIsEnabled() { return LocalValue.GetValue(); } public RRRTogglePatch Bind(Harmony harmony, ConfigFile config, string section, bool defaultValue = true) { harmony.PatchAll(GetType()); LocalValue = RRRConfig.Bind(config, section, GetType().Name, defaultValue, Description); return this; } } public static class Util { public static readonly JSONParameters JsonParameters = new JSONParameters { EnableAnonymousTypes = true }; public static List<T> AllOf<T>() { return Enum.GetValues(typeof(T)).OfType<T>().ToList(); } public static bool IsGameInMainScene() { return (Object)(object)ZNetScene.instance != (Object)null; } public static bool DoesPluginExist(string pluginGuid) { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { if (pluginInfo.Value.Metadata.GUID == pluginGuid) { return true; } } return false; } public static string GetPluginPath(Type modPluginType) { return Path.GetDirectoryName(modPluginType.Assembly.Location); } public static AssetBundle LoadAssetBundle(Type modPluginType, string bundleName) { Assembly assembly = modPluginType.Assembly; return AssetBundle.LoadFromStream(assembly.GetManifestResourceStream(assembly.GetName().Name + "." + bundleName)); } public static bool IsNotNull(this object type) { return type != null; } public static bool IsEmpty(this string s) { return string.IsNullOrEmpty(s); } public static bool NonEmpty(this string s) { return !string.IsNullOrEmpty(s); } public static string TrimCloneTag(this string s) { return (!s.EndsWith("(Clone)")) ? s : s.Substring(0, s.Length - "(Clone)".Length); } public static (string left, string right) SplitOnFirst(this string s, string delimiter) { if (Utility.IsNullOrWhiteSpace(s)) { return (null, null); } int num = s.IndexOf(delimiter, StringComparison.Ordinal); return (num == -1) ? (s, null) : (s.Remove(num), s.Substring(num + 1)); } public static bool IsEmpty<T>(this IEnumerable<T> l) { return l.Count() == 0; } public static bool NonEmpty<T>(this List<T> l) { return l.Count > 0; } public static bool IsEmpty<K, V>(this Dictionary<K, V> d) { return d.Count == 0; } public static bool NonEmpty<K, V>(this Dictionary<K, V> d) { return d.Count > 0; } public static T RandomMember<T>(this List<T> l) { return l[Random.Range(0, l.Count)]; } public static bool ExistsName(this IEnumerable<GameObject> self, string name) { foreach (GameObject item in self) { if (((Object)item).name == name) { return true; } } return false; } public static void RetuneDamage(this ref DamageTypes damageTypes, float newTotal, float chop = 0f, float pickaxe = 0f) { //IL_0017: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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) float num = ((DamageTypes)(ref damageTypes)).GetTotalPhysicalDamage() + ((DamageTypes)(ref damageTypes)).GetTotalElementalDamage(); List<Tuple<FieldInfo, float>> list = new List<Tuple<FieldInfo, float>>(); FieldInfo[] fields = ((object)damageTypes).GetType().GetFields(); foreach (FieldInfo fieldInfo in fields) { if (!(fieldInfo.Name == "m_chop") && !(fieldInfo.Name == "m_pickaxe")) { float num2 = (float)fieldInfo.GetValue(damageTypes); if ((double)num2 > 0.0) { list.Add(new Tuple<FieldInfo, float>(fieldInfo, num2)); } } } object obj = damageTypes; foreach (Tuple<FieldInfo, float> item3 in list) { item3.Deconstruct(out var item, out var item2); FieldInfo fieldInfo2 = item; float num3 = item2; object obj2 = obj; float num4 = (float)((double)newTotal * ((double)num3 / (double)num)); fieldInfo2.SetValue(obj2, num4); } damageTypes = (DamageTypes)obj; damageTypes.m_chop = chop; damageTypes.m_pickaxe = pickaxe; } public static List<byte[]> SplitByteArray(byte[] source, int chunkSize = 500000) { List<byte[]> list = new List<byte[]>(); int num = source.Length; int num2; for (int i = 0; i < num; i += num2) { num2 = Math.Min(chunkSize, num - i); byte[] array = new byte[num2]; Array.Copy(source, i, array, 0, num2); list.Add(array); } return list; } public static byte[] ConcatenateByteArrays(List<byte[]> arrays) { byte[] array = new byte[arrays.Sum((byte[] arr) => arr.Length)]; int num = 0; foreach (byte[] array2 in arrays) { Array.Copy(array2, 0, array, num, array2.Length); num += array2.Length; } return array; } } public static class RRRMobWeaponFactory { private static string MakeName(string ownerName, string weaponName, string animName = null, string projName = null, string attackInterval = null) { return ownerName + "@" + weaponName + "@" + animName + "@" + projName + "@" + attackInterval; } public static GameObject Get(GameObject owner, string weaponName, bool isNpc = false, RRRMobDataUtil.DamageTypes damageByType = null, float? squishTotalDamage = null, string animationName = null, string projectileName = null, float? attackInterval = null, string forceName = null) { //IL_0126: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Invalid comparison between Unknown and I4 string text = forceName ?? MakeName(((Object)owner).name, weaponName, animationName, projectileName, attackInterval?.ToString()); bool alreadyExisted = false; GameObject val = RRRPrefabLoader.CloneRepeatable(ref alreadyExisted, weaponName, text, regZns: true, regOdb: true); if (alreadyExisted) { return val; } ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { throw new NullReferenceException("No ItemDrop component in prefab: " + weaponName); } SharedData shared = component.m_itemData.m_shared; shared.m_name = text; shared.m_useDurability = false; if (!Utility.IsNullOrWhiteSpace(shared.m_setName)) { SharedData val2 = shared; val2.m_setName = val2.m_setName + "_rrr_" + ((Object)owner).name; } if (!Utility.IsNullOrWhiteSpace(shared.m_attack.m_attackOriginJoint) && (Object)(object)Utils.FindChild(owner.transform, shared.m_attack.m_attackOriginJoint, (IterativeSearchType)0) == (Object)null) { shared.m_attack.m_attackOriginJoint = ""; } if (damageByType.IsNotNull()) { shared.m_damages = damageByType.Make(); } if (squishTotalDamage.HasValue) { shared.m_damages.RetuneDamage(squishTotalDamage.Value); } if (!Utility.IsNullOrWhiteSpace(animationName)) { shared.m_attack.m_attackAnimation = animationName; } if ((int)shared.m_attack.m_attackType == 2) { if (projectileName.IsNotNull() || (Object)(object)shared.m_attack.m_attackProjectile == (Object)null) { shared.m_attack.m_attackProjectile = ZNetScene.instance.GetPrefab(Utility.IsNullOrWhiteSpace(projectileName) ? "draugr_bow_projectile" : projectileName); } if (isNpc) { shared.m_ammoType = ""; shared.m_aiAttackRange = 25f; shared.m_aiAttackRangeMin = 0f; shared.m_aiAttackMaxAngle = 10f; shared.m_attackForce = 15f; shared.m_attack.m_drawDurationMin = 0f; shared.m_attack.m_drawStaminaDrain = 20f; shared.m_attack.m_drawAnimationState = ""; shared.m_secondaryAttack.m_drawDurationMin = 0f; shared.m_secondaryAttack.m_drawStaminaDrain = 20f; shared.m_secondaryAttack.m_drawAnimationState = ""; shared.m_attack.m_bowDraw = false; shared.m_attack.m_speedFactor = 0f; shared.m_attack.m_speedFactorRotation = 0.5f; shared.m_attack.m_attackStartNoise = 20f; shared.m_attack.m_attackHitNoise = 30f; shared.m_attack.m_projectileVel = 30f; shared.m_attack.m_projectileVelMin = 2f; shared.m_attack.m_projectileAccuracy = 2f; ItemDrop component2 = shared.m_attack.m_attackProjectile.GetComponent<ItemDrop>(); if (component2.IsNotNull()) { ((DamageTypes)(ref component2.m_itemData.m_shared.m_damages)).Modify(0f); ((DamageTypes)(ref component2.m_itemData.m_shared.m_damagesPerLevel)).Modify(0f); } } } if (attackInterval.HasValue) { shared.m_aiAttackInterval = attackInterval.Value; } return val; } public static GameObject GetNpcUnarmed(string ownerName, RRRMobDataUtil.DamageTypes damageByType = null, float? squishTotalDamage = null) { //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) string text = MakeName(ownerName, "npcunarmed"); bool alreadyExisted = false; GameObject val = RRRPrefabLoader.CloneRepeatable(ref alreadyExisted, ((Component)((Humanoid)ZNetScene.instance.GetPrefab("Player").GetComponent<Player>()).m_unarmedWeapon).gameObject, text, regZns: true, regOdb: true); if (alreadyExisted) { return val; } SharedData shared = val.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_name = text; if (damageByType.IsNotNull()) { shared.m_damages = damageByType.Make(); } if (squishTotalDamage.HasValue) { shared.m_damages.RetuneDamage(squishTotalDamage.Value); } return val; } } } namespace RRRCore.monster { internal static class GDThornweaver { internal static string OriginalName = "Greydwarf_Shaman"; private static Color GlowPurple = new Color(0.6f, 0f, 0.8f); private static float Health = Balance.Enemy.BasicHealth(3) * 1.25f; private static float ShootDmgPierce = Balance.Enemy.BasicDamage(3) * 0.75f; private static float ShootDmgPoison = Balance.Enemy.BasicDamage(3) * 0.25f; private static float NovaDmgPoison = Balance.Enemy.BasicDamage(3) * 1.2f; internal static void LateLoadGdThornweaver(GameObject clone) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) Character component = clone.GetComponent<Character>(); component.m_name = "Greydwarf Thornweaver"; component.m_health = Health; component.m_acceleration *= 1.25f; component.m_speed *= 1.25f; component.m_walkSpeed *= 1.25f; component.m_runSpeed *= 1.25f; ((Humanoid)component).m_defaultItems = (GameObject[])(object)new GameObject[2] { DesignThornShoot(), DesignPoisonNova() }; GameObject val = RRRPrefabLoader.Clone("Greydwarf_Shaman_ragdoll", ((Object)clone).name + "_ragdoll"); component.m_deathEffects.m_effectPrefabs[2].m_prefab = val; DesignAppearance(clone); DesignAppearance(val); } private static GameObject DesignThornShoot() { GameObject val = RRRPrefabLoader.Clone("gd_king_shoot", RRRMonsterName.RRR_GDThornweaver.ToString() + "_shoot", regZns: true, regOdb: true); SharedData shared = val.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_aiAttackRangeMin = 2f; shared.m_dodgeable = true; shared.m_blockable = true; shared.m_damages.m_poison = ShootDmgPoison; shared.m_damages.m_pierce = ShootDmgPierce; shared.m_attack.m_attackAnimation = "spray"; shared.m_attack.m_projectileVel = 80f; shared.m_attack.m_attackHeight = 0.8f; shared.m_attack.m_attackRange = 2.15f; shared.m_attack.m_attackAngle = 10f; shared.m_attack.m_attackRayWidth = 1f; shared.m_attack.m_projectileBursts = 2; shared.m_attack.m_projectileAccuracy = 1f; shared.m_attack.m_burstInterval = 0.5f; shared.m_aiAttackInterval = 2f; shared.m_aiAttackRange = 25f; shared.m_aiAttackRangeMin = 1f; shared.m_startEffect = ObjectDB.instance.GetItemPrefab("Greydwarf_shaman_attack").GetComponent<ItemDrop>().m_itemData.m_shared.m_startEffect; return val; } private static GameObject DesignPoisonNova() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) GameObject val = RRRPrefabLoader.Clone("Greydwarf_shaman_heal", RRRMonsterName.RRR_GDThornweaver.ToString() + "_nova", regZns: true, regOdb: true); SharedData shared = val.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_aiTargetType = (AiTarget)0; shared.m_damages.m_poison = NovaDmgPoison; shared.m_aiAttackInterval = 6f; shared.m_aiAttackRange = 5f; shared.m_attackStatusEffect = null; GameObject val2 = RRRPrefabLoader.Clone(shared.m_attack.m_attackProjectile, ((Object)val).name + "_proj"); shared.m_attack.m_attackProjectile = val2; Aoe component = val2.GetComponent<Aoe>(); component.m_dodgeable = true; component.m_hitEnemy = true; component.m_hitOwner = false; component.m_hitSame = false; component.m_hitFriendly = false; component.m_statusEffect = null; component.m_ttl = 3f; component.m_hitInterval = 1f; ParticleSystem[] componentsInChildren = val2.GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val3 in componentsInChildren) { if (((Object)((Component)val3).gameObject).name == "flames_world") { ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime; MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; Gradient gradient = ((MinMaxGradient)(ref color)).gradient; GradientColorKey[] colorKeys = gradient.colorKeys; colorKeys[0].color = new Color(0.64f, 0.11f, 1f); colorKeys[1].color = new Color(0.4f, 0f, 0.7f); gradient.colorKeys = colorKeys; ((MinMaxGradient)(ref color)).gradient = gradient; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = color; } } Light[] componentsInChildren2 = val2.GetComponentsInChildren<Light>(); foreach (Light val4 in componentsInChildren2) { if (((Object)((Component)val4).gameObject).name == "Point light") { val4.color = GlowPurple; } } return val; } private static void DesignAppearance(GameObject clone) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) Transform transform = clone.transform; transform.localScale *= 1.25f; SkinnedMeshRenderer[] componentsInChildren = clone.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val in componentsInChildren) { if (((Object)((Component)val).gameObject).name == "Cube" || ((Object)((Component)val).gameObject).name == "Cube.001") { ((Renderer)val).sharedMaterial = new Material(((Renderer)val).sharedMaterial); ((Renderer)val).sharedMaterial.mainTexture = (Texture)(object)Plugin.MonstersAssets.LoadAsset<Texture2D>("Assets/Textures/rrr_gdthornweaver_diffuse.png"); } } ParticleSystem[] componentsInChildren2 = ZNetScene.instance.GetPrefab("gd_king").GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val2 in componentsInChildren2) { if (((Object)((Component)val2).gameObject).name == "branches") { ParticleSystem val3 = Object.Instantiate<ParticleSystem>(val2, clone.transform.Find("Visual/Armature.001/root/spine1/spine2/spine3/l_shoulder/l_arm1/l_arm2/l_hand/l_middle1/")); ShapeModule shape = val3.shape; ((ShapeModule)(ref shape)).enabled = false; MainModule main = val3.main; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.05f); ((MainModule)(ref main)).maxParticles = 80; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(1.7f, 1.8f); MainModule val4 = main; Object.Instantiate<ParticleSystem>(val3, clone.transform.Find("Visual/Armature.001/root/spine1/spine2/spine3/r_shoulder/r_arm1/r_arm2/r_hand/r_middle1/")); break; } } Light[] componentsInChildren3 = ZNetScene.instance.GetPrefab("Ghost").GetComponentsInChildren<Light>(); foreach (Light val5 in componentsInChildren3) { if (((Object)((Component)val5).gameObject).name == "Point light") { Light val6 = Object.Instantiate<Light>(val5, clone.transform.Find("Visual/Armature.001/root/spine1/spine2/spine3/")); val6.color = GlowPurple; ((Component)val6).transform.localPosition = Vector3.zero; val6.intensity = 2f; } } } } internal static class GhostVengeful { internal static string OriginalName = "Ghost"; private static float Health = Balance.Enemy.BasicHealth(3); private static float MeleeDmgSlash = Balance.Enemy.BasicDamage(3) * 0.75f; private static float MeleeDmgFire = Balance.Enemy.BasicDamage(3) * 0.4f; internal static void LateLoadGhostVengeful(GameObject clone) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) Character component = clone.GetComponent<Character>(); component.m_name = "Vengeful Ghost"; component.m_health = Health; component.m_acceleration *= 1.5f; component.m_speed *= 1.5f; component.m_walkSpeed *= 1.5f; component.m_runSpeed *= 1.5f; ((Humanoid)component).m_randomWeapon = (GameObject[])(object)new GameObject[1] { DesignBurnAttack() }; ParticleSystem[] componentsInChildren = clone.GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val in componentsInChildren) { if (((Object)((Component)val).gameObject).name == "evil_smoke") { MainModule main = val.main; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; ((MinMaxGradient)(ref startColor)).color = new Color(0.5f, 0f, 0f, 1f); MinMaxGradient startColor2 = startColor; ((MainModule)(ref main)).startColor = startColor2; } } Light[] componentsInChildren2 = clone.GetComponentsInChildren<Light>(); foreach (Light val2 in componentsInChildren2) { if (((Object)((Component)val2).gameObject).name == "Point light") { val2.color = Color.red; val2.intensity = 2f; } } } private static GameObject DesignBurnAttack() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) GameObject val = RRRPrefabLoader.Clone("Ghost_attack", $"{RRRMonsterName.RRR_GhostVengeful}_attack", regZns: true, regOdb: true); ItemDrop component = val.GetComponent<ItemDrop>(); SharedData shared = component.m_itemData.m_shared; DamageTypes damages = component.m_itemData.m_shared.m_damages; damages.m_slash = MeleeDmgSlash; damages.m_fire = MeleeDmgFire; shared.m_damages = damages; return val; } } internal static class Grig { internal static void EarlyLoadGrig() { GameObject val = Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/RRR_GrigHorn.prefab"); if (ObjectDB.instance.m_items.NonEmpty() && !ObjectDB.instance.m_items.Contains(val)) { ObjectDB.instance.m_items.Add(val); ObjectDB.instance.UpdateRegisters(); } if (Util.IsGameInMainScene() && !ZNetScene.instance.m_prefabs.Contains(val)) { ZNetScene.instance.m_prefabs.Add(val); ZNetScene.instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)val).name), val); } } internal static void LateLoadGrig() { RRRPrefabLoader.Add(RRRReplaceRefHandler.ProcessReplaceRefs(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/RRR_Grig.prefab"))); RRRPrefabLoader.Add(RRRReplaceRefHandler.ProcessReplaceRefs(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/RRR_Grig_ragdoll.prefab"))); RRRPrefabLoader.Add(RRRReplaceRefHandler.ProcessReplaceRefs(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_atk_swipe1.prefab")), regZns: false, regOdb: true); RRRPrefabLoader.Add(RRRReplaceRefHandler.ProcessReplaceRefs(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_atk_swipe2.prefab")), regZns: false, regOdb: true); RRRPrefabLoader.Add(RRRReplaceRefHandler.ProcessReplaceRefs(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_atk_shadowstep.prefab")), regZns: false, regOdb: true); RRRPrefabLoader.Add(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_sfx_attack.prefab")); RRRPrefabLoader.Add(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_sfx_hit.prefab")); RRRPrefabLoader.Add(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_sfx_death.prefab")); RRRPrefabLoader.Add(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_vfx_shadowstep.prefab")); RRRPrefabLoader.Add(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_sfx_shadowstepStart.prefab")); RRRPrefabLoader.Add(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_sfx_shadowstepEnd.prefab")); RRRPrefabLoader.Add(Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_sfx_laugh.prefab")); GameObject val = Plugin.MonstersAssets.LoadAsset<GameObject>("Assets/Prefabs/grig/rrr_grig_mx_shadowstep.prefab"); if ((Object)(object)val.GetComponent<RRRShadowstep>() == (Object)null) { val.AddComponent(typeof(RRRShadowstep)); } RRRPrefabLoader.Add(val); } } public class RRRShadowstep : MonoBehaviour { private ZNetView view; private GameObject grig; private MonsterAI monsterAI; private float timer; private bool moved; private void Start() { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) view = ((Component)this).GetComponent<ZNetView>(); if (!view.IsValid() || !view.IsOwner()) { return; } Transform parent = ((Component)this).transform.parent; ((Component)this).transform.parent = null; if ((Object)(object)parent == (Object)null || (Object)(object)((Component)parent).gameObject.GetComponent<MonsterAI>() == (Object)null) { Fail("Shadowstep had wrong parent."); return; } grig = ((Component)parent).gameObject; monsterAI = grig.GetComponent<MonsterAI>(); Character targetCreature = monsterAI.m_targetCreature; if (!Object.op_Implicit((Object)(object)targetCreature)) { Fail("No target for shadowstep."); return; } ZSFX component = Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("rrr_grig_sfx_shadowstepEnd"), ((Component)this).transform.position, Quaternion.identity).GetComponent<ZSFX>(); component.m_minDelay = 0.5f; component.m_maxDelay = 0.5f; Vector3 localPosition = ((Component)this).transform.localPosition; Vector3 localPosition2 = ((Component)targetCreature).transform.localPosition; localPosition.y = 0f; localPosition2.y = 0f; if ((double)Vector3.Dot(localPosition - localPosition2, ((Component)targetCreature).transform.forward) >= 0.0) { ((Component)this).transform.localPosition = ((Component)targetCreature).transform.localPosition - ((Component)targetCreature).transform.forward * 2f; ((Component)this).transform.localRotation = ((Component)targetCreature).transform.localRotation; } else { ((Component)this).transform.localPosition = ((Component)targetCreature).transform.localPosition + ((Component)targetCreature).transform.forward * 2f; ((Component)this).transform.localRotation = ((Component)targetCreature).transform.localRotation; ((Component)this).transform.RotateAround(((Component)this).transform.localPosition, ((Component)this).transform.up, 180f); } Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("rrr_grig_sfx_shadowstepStart"), ((Component)this).transform.position, Quaternion.identity); Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("rrr_grig_sfx_shadowstepEnd"), ((Component)this).transform.position, Quaternion.identity); ZSFX component2 = Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("rrr_grig_sfx_shadowstepEnd"), ((Component)this).transform.position, Quaternion.identity).GetComponent<ZSFX>(); component2.m_minDelay = 0.25f; component2.m_maxDelay = 0.25f; ZSFX component3 = Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("rrr_grig_sfx_laugh"), ((Component)this).transform.position, Quaternion.identity).GetComponent<ZSFX>(); component3.m_minDelay = 0.25f; component3.m_maxDelay = 0.25f; } private void FixedUpdate() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (!view.IsValid() || !view.IsOwner()) { return; } if ((Object)(object)grig == (Object)null) { Fail("No caster for shadowstep (probably dead)."); return; } timer += Time.fixedDeltaTime; if ((double)timer >= 0.15000000596046448 && !moved) { grig.transform.localPosition = ((Component)this).transform.localPosition; grig.transform.localRotation = ((Component)this).transform.localRotation; moved = true; } if (!((double)timer < 2.0)) { Fail(); } } private void Fail(string warning = "") { if (!Utility.IsNullOrWhiteSpace(warning)) { Plugin.log.LogWarning((object)warning); } ZNetScene.instance.Destroy(((Component)this).gameObject); } } public static class TrollTosser { internal static string OriginalName = "Troll"; internal static void LateLoadTrollTosser(GameObject clone) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown Character component = clone.GetComponent<Character>(); component.m_name = "Troll Tosser"; component.m_health *= 1.1f; component.m_acceleration *= 1.25f; component.m_speed *= 1.25f; component.m_walkSpeed *= 1.25f; component.m_runSpeed *= 1.25f; Humanoid val = (Humanoid)component; val.m_defaultItems = (GameObject[])(object)new GameObject[2] { DesignBoulderToss(), DesignGroundSlam() }; val.m_randomSets = (ItemSet[])(object)new ItemSet[0]; GameObject val2 = RRRPrefabLoader.Clone("Troll_ragdoll", ((Object)clone).name + "_ragdoll"); component.m_deathEffects.m_effectPrefabs[1].m_prefab = val2; DesignAppearance(clone); DesignAppearance(val2); } private static GameObject DesignBoulderToss() { GameObject val = RRRPrefabLoader.Clone("troll_throw", RRRMonsterName.RRR_TrollTosser.ToString() + "_throw", regZns: true, regOdb: true); SharedData shared = val.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_dodgeable = true; shared.m_blockable = true; shared.m_attack.m_projectileVel = 70f; shared.m_attack.m_projectileBursts = 2; shared.m_attack.m_projectileAccuracy = 6f; shared.m_attack.m_projectileAccuracyMin = 12f; shared.m_attack.m_burstInterval = 0f; shared.m_aiAttackInterval = 4f; shared.m_aiAttackRange = 25f; shared.m_aiAttackRangeMin = 8f; shared.m_aiPrioritized = true; return val; } private static GameObject DesignGroundSlam() { GameObject val = RRRPrefabLoader.Clone("troll_groundslam", RRRMonsterName.RRR_TrollTosser.ToString() + "_slam", regZns: true, regOdb: true); SharedData shared = val.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_damages.m_blunt *= 1.2f; shared.m_attack.m_attackRange = 6f; shared.m_aiAttackInterval = 2f; shared.m_aiAttackRange = 6f; return val; } private static void DesignAppearance(GameObject clone) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown clone.transform.localScale = new Vector3(1.2f, 1.1f, 1.2f); SkinnedMeshRenderer[] componentsInChildren = clone.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val in componentsInChildren) { if (((Object)((Component)val).gameObject).name == "Body" || ((Object)((Component)val).gameObject).name == "Hair") { ((Renderer)val).sharedMaterial = new Material(((Renderer)val).sharedMaterial); ((Renderer)val).sharedMaterial.mainTexture = (Texture)(object)Plugin.MonstersAssets.LoadAsset<Texture2D>("Assets/Textures/rrr_trolltosser_diffuse.png"); } } } } } namespace RRRCore.npc { internal static class Hostile { internal const string OriginalName = "Goblin"; internal static void DesignHumanEnemy(this GameObject clone, int tier) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown Npc.DesignNpcBase(clone); Character component = clone.GetComponent<Character>(); Humanoid component2 = clone.GetComponent<Humanoid>(); component.m_health = Balance.Enemy.BasicHealth(tier); component.m_faction = (Faction)6; ((Character)component2).m_walkSpeed = 1f; ((Character)component2).m_speed = 2f; ((Character)component2).m_runSpeed = 5f; ((Character)component2).m_acceleration = 0.7f; ((Character)component2).m_swimSpeed = 3f; ((Character)component2).m_staggerDamageFactor = 0.25f; clone.AddComponent<RRRCustomDrop>().Config(Balance.Food.AllAvailableAtTier(Math.Max(tier - 1, 1)), 0.5f, 0.5f, 0, 3); clone.GetComponent<CharacterDrop>().m_drops.Add(new Drop { m_prefab = ZNetScene.instance.GetPrefab("Coins"), m_amountMin = tier, m_amountMax = tier * 2, m_chance = 0.25f }); switch (tier) { case 1: component.m_name = "Feral Madman"; component2.m_unarmedWeapon = RRRMobWeaponFactory.GetNpcUnarmed(((Object)clone).name, null, 1f).GetComponent<ItemDrop>(); break; case 2: { component.m_name = "Gibbering Drifter"; GameObject val = RRRMobWeaponFactory.Get(clone, "Club", isNpc: true, null, Balance.Enemy.BasicDamage(tier)); component2.m_randomWeapon = (GameObject[])(object)new GameObject[5] { val, val, val, val, RRRMobWeaponFactory.Get(clone, "Bow", isNpc: true, null, Balance.Enemy.BasicDamage(tier), null, "draugr_bow_projectile") }; break; } case 3: component.m_name = "Delirious Wanderer"; component2.m_defaultItems = (GameObject[])(object)new GameObject[2] { ZNetScene.instance.GetPrefab("ArmorLeatherChest"), ZNetScene.instance.GetPrefab("ArmorBronzeLegs") }; component2.m_randomWeapon = (GameObject[])(object)new GameObject[5] { RRRMobWeaponFactory.Get(clone, "SwordBronze", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "MaceBronze", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "SpearBronze", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "AxeBronze", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "BowFineWood", isNpc: true, null, Balance.Enemy.BasicDamage(tier), null, "draugr_bow_projectile") }; break; case 4: component.m_name = "Raving Brigand"; component2.m_defaultItems = (GameObject[])(object)new GameObject[2] { ZNetScene.instance.GetPrefab("ArmorBronzeChest"), ZNetScene.instance.GetPrefab("ArmorTrollLeatherLegs") }; component2.m_randomWeapon = (GameObject[])(object)new GameObject[5] { RRRMobWeaponFactory.Get(clone, "SwordIron", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "MaceIron", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "SpearBronze", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "AxeIron", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "BowFineWood", isNpc: true, null, Balance.Enemy.BasicDamage(tier), null, "draugr_bow_projectile") }; component2.m_randomArmor = (GameObject[])(object)new GameObject[3] { ZNetScene.instance.GetPrefab("HelmetBronze"), ZNetScene.instance.GetPrefab("CapeDeerHide"), ZNetScene.instance.GetPrefab("ShieldBronzeBuckler") }; break; case 5: component.m_name = "Deranged Recruit"; component2.m_defaultItems = (GameObject[])(object)new GameObject[2] { ZNetScene.instance.GetPrefab("ArmorIronChest"), ZNetScene.instance.GetPrefab("ArmorBronzeLegs") }; component2.m_randomWeapon = (GameObject[])(object)new GameObject[5] { RRRMobWeaponFactory.Get(clone, "SwordIron", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "MaceIron", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "SpearElderbark", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "AxeIron", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "BowHuntsman", isNpc: true, null, Balance.Enemy.BasicDamage(tier), null, "draugr_bow_projectile") }; component2.m_randomArmor = (GameObject[])(object)new GameObject[3] { ZNetScene.instance.GetPrefab("HelmetIron"), ZNetScene.instance.GetPrefab("CapeLinen"), ZNetScene.instance.GetPrefab("ShieldSilver") }; break; case 6: component.m_name = "Addled Deserter"; component2.m_defaultItems = (GameObject[])(object)new GameObject[2] { ZNetScene.instance.GetPrefab("ArmorIronChest"), ZNetScene.instance.GetPrefab("ArmorIronLegs") }; component2.m_randomWeapon = (GameObject[])(object)new GameObject[5] { RRRMobWeaponFactory.Get(clone, "SwordBlackmetal", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "MaceIron", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "AtgeirBlackmetal", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "AxeBlackMetal", isNpc: true, null, Balance.Enemy.BasicDamage(tier)), RRRMobWeaponFactory.Get(clone, "BowHuntsman", isNpc: true, null, Balance.Enemy.BasicDamage(tier), null, "draugr_bow_projectile") }; component2.m_randomArmor = (GameObject[])(object)new GameObject[3] { ZNetScene.instance.GetPrefab("HelmetDrake"), ZNetScene.instance.GetPrefab("CapeLox"), ZNetScene.instance.GetPrefab("ShieldSilver") }; break; default: throw new Exception($"No such tier '{tier}', only (1-6) allowed."); } } internal static void MakePrefabs() { for (int i = 1; i <= 6; i++) { RRRPrefabLoader.Clone("Goblin", RRRNpcName.HostileTiered(i)).DesignHumanEnemy(i); } } } public static class Npc { public const string OriginalName = "Goblin"; public static void DesignNpcBase(GameObject clone, bool sfxNoAlert = false, bool sfxNoIdle = false, bool sfxNoHit = false, bool sfxNoDeath = false) { //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Expected O, but got Unknown //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Expected O, but got Unknown //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Expected O, but got Unknown //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Expected O, but got Unknown //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < clone.transform.childCount; i++) { Object.Destroy((Object)(object)((Component)clone.transform.GetChild(i)).gameObject); } GameObject prefab = ZNetScene.instance.GetPrefab("Player"); GameObject eyePos = null; for (int j = 0; j < prefab.transform.childCount; j++) { GameObject val = Object.Instantiate<GameObject>(((Component)prefab.transform.GetChild(j)).gameObject, clone.transform); ((Object)val).name = ((Object)val).name.TrimCloneTag(); if (((Object)val).name == "EyePos") { eyePos = val; } } VisEquipment component = clone.GetComponent<VisEquipment>(); component.m_bodyModel = ((Component)clone.transform.Find("Visual/body")).GetComponent<SkinnedMeshRenderer>(); component.m_leftHand = ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/LeftShoulder/LeftArm/LeftForeArm/LeftHand/LeftHand_Attach")).GetComponent<Transform>(); component.m_rightHand = ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach")).GetComponent<Transform>(); component.m_helmet = ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/Neck/Head/Helmet_attach")).GetComponent<Transform>(); component.m_backShield = ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/BackShield_attach")).GetComponent<Transform>(); component.m_backMelee = ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/BackOneHanded_attach")).GetComponent<Transform>(); component.m_backTwohandedMelee = ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/BackTwohanded_attach")).GetComponent<Transform>(); component.m_backBow = ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/BackBow_attach")).GetComponent<Transform>(); component.m_backTool = ((Component)clone.transform.Find("Visual/Armature/Hips/BackTool_attach")).GetComponent<Transform>(); component.m_backAtgeir = ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/BackAtgeir_attach")).GetComponent<Transform>(); component.m_clothColliders = (CapsuleCollider[])(object)new CapsuleCollider[5] { ((Component)clone.transform.Find("Visual/Armature/Hips/ClothCollider")).GetComponent<CapsuleCollider>(), ((Component)clone.transform.Find("Visual/Armature/Hips/LeftUpLeg/ClothCollider")).GetComponent<CapsuleCollider>(), ((Component)clone.transform.Find("Visual/Armature/Hips/RightUpLeg/ClothCollider")).GetComponent<CapsuleCollider>(), ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/ClothCollider (3)")).GetComponent<CapsuleCollider>(), ((Component)clone.transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/ClothCollider (4)")).GetComponent<CapsuleCollider>() }; component.m_models = prefab.GetComponent<VisEquipment>().m_models; component.m_isPlayer = true; CapsuleCollider component2 = clone.GetComponent<CapsuleCollider>(); component2.center = prefab.GetComponent<CapsuleCollider>().center; component2.radius = prefab.GetComponent<CapsuleCollider>().radius; component2.height = prefab.GetComponent<CapsuleCollider>().height; clone.GetComponent<Rigidbody>().interpolation = prefab.GetComponent<Rigidbody>().interpolation; ZSyncAnimation component3 = clone.GetComponent<ZSyncAnimation>(); ZSyncAnimation component4 = prefab.GetComponent<ZSyncAnimation>(); component3.m_syncBools = new List<string>(component4.m_syncBools); component3.m_syncFloats = new List<string>(component4.m_syncFloats); component3.m_syncInts = new List<string>(component4.m_syncInts); FootStep component5 = clone.GetComponent<FootStep>(); FootStep component6 = prefab.GetComponent<FootStep>(); component5.m_footstepCullDistance = component6.m_footstepCullDistance; component5.m_effects.Clear(); foreach (StepEffect effect in component6.m_effects) { component5.m_effects.Add(effect); } component5.m_feet[0] = clone.transform.Find("Visual/Armature/Hips/LeftUpLeg/LeftLeg/LeftFoot"); component5.m_feet[1] = clone.transform.Find("Visual/Armature/Hips/RightUpLeg/RightLeg/RightFoot"); DesignCompHumanoid(clone, prefab, eyePos, sfxNoHit, sfxNoDeath); Character component7 = clone.GetComponent<Character>(); component7.m_name = "Human"; component7.m_health = 100f; component7.m_faction = (Faction)0; MonsterAI component8 = clone.GetComponent<MonsterAI>(); ((BaseAI)component8).m_pathAgentType = (AgentType)1; if (sfxNoAlert) { ((BaseAI)component8).m_alertedEffects = null; } else { MonsterAI val2 = component8; EffectList val3 = new EffectList(); val3.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = DesignSfxDeepen("sfx_goblin_alerted", "RRR_NPC_sfx_alerted") } }; EffectList alertedEffects = val3; ((BaseAI)val2).m_alertedEffects = alertedEffects; } if (sfxNoIdle) { ((BaseAI)component8).m_idleSound = null; } else { MonsterAI val4 = component8; EffectList val5 = new EffectList(); val5.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = DesignSfxDeepen("sfx_goblin_idle", "RRR_NPC_sfx_idle") } }; EffectList idleSound = val5; ((BaseAI)val4).m_idleSound = idleSound; } clone.GetComponent<CharacterDrop>().m_drops.Clear(); RRRNpcCustomization rRRNpcCustomization = clone.AddComponent<RRRNpcCustomization>(); rRRNpcCustomization.IsFemale = false; rRRNpcCustomization.BeardItems = new List<string> { "BeardNone" }; for (int k = 1; k <= 10; k++) { rRRNpcCustomization.BeardItems.Add($"Beard{k}"); } rRRNpcCustomization.HairItems = new List<string> { "HairNone" }; for (int l = 1; l <= 14; l++) { rRRNpcCustomization.HairItems.Add($"Hair{l}"); } rRRNpcCustomization.HairColorMin = new Color(1f, 0.5f, 0.3f); rRRNpcCustomization.HairColorMax = new Color(1f, 0.9f, 0.7f); rRRNpcCustomization.SkinColorMin = new Color(0.5f, 0.5f, 0.5f); rRRNpcCustomization.SkinColorMax = new Color(1f, 1f, 1f); rRRNpcCustomization.HairValueMin = 0.1f; rRRNpcCustomization.HairValueMax = 1f; } private static void DesignCompHumanoid(GameObject clone, GameObject playerPrefab, GameObject eyePos, bool sfxNoHit, bool sfxNoDeath) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_016f: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown Humanoid component = clone.GetComponent<Humanoid>(); Humanoid component2 = playerPrefab.GetComponent<Humanoid>(); ((Character)component).m_eye = eyePos.transform; ((Character)component).m_crouchSpeed = ((Character)component2).m_crouchSpeed; ((Character)component).m_walkSpeed = ((Character)component2).m_walkSpeed; ((Character)component).m_speed = ((Character)component2).m_speed; ((Character)component).m_turnSpeed = ((Character)component2).m_turnSpeed; ((Character)component).m_runSpeed = ((Character)component2).m_runSpeed; ((Character)component).m_runTurnSpeed = ((Character)component2).m_runTurnSpeed; ((Character)component).m_acceleration = ((Character)component2).m_acceleration; ((Character)component).m_jumpForce = ((Character)component2).m_jumpForce; ((Character)component).m_jumpForceForward = ((Character)component2).m_jumpForceForward; ((Character)component).m_swimDepth = ((Character)component2).m_swimDepth; ((Character)component).m_swimSpeed = ((Character)component2).m_swimSpeed; ((Character)component).m_damageModifiers = ((DamageModifiers)(ref ((Character)component2).m_damageModifiers)).Clone(); component.m_defaultItems = (GameObject[])(object)new GameObject[0]; component.m_randomWeapon = (GameObject[])(object)new GameObject[0]; component.m_randomArmor = (GameObject[])(object)new GameObject[0]; component.m_randomShield = (GameObject[])(object)new GameObject[0]; component.m_randomSets = (ItemSet[])(object)new ItemSet[0]; ((Character)component).m_hitEffects = CloneEffectList(((Character)component2).m_hitEffects); if (!sfxNoHit) { ((Character)component).m_hitEffects.m_effectPrefabs[1].m_prefab = DesignSfxDeepen("sfx_goblin_hit", "RRR_NPC_sfx_hit"); } ((Character)component).m_critHitEffects = CloneEffectList(((Character)component2).m_critHitEffects); ((Character)component).m_backstabHitEffects = CloneEffectList(((Character)component).m_backstabHitEffects); List<EffectData> list = new List<EffectData> { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("vfx_player_death") } }; bool alreadyExisted = false; EffectData val = new EffectData { m_prefab = RRRPrefabLoader.CloneRepeatable(ref alreadyExisted, "Player_ragdoll", "RRR_NPC_ragdoll") }; list.Add(val); if (!alreadyExisted) { Ragdoll component3 = val.m_prefab.GetComponent<Ragdoll>(); component3.m_ttl = 2f; component3.m_removeEffect = CloneEffectList(ZNetScene.instance.GetPrefab("Greydwarf_ragdoll").GetComponent<Ragdoll>().m_removeEffect); val.m_prefab.GetComponent<VisEquipment>().m_isPlayer = true; } if (!sfxNoDeath) { list.Add(new EffectData { m_prefab = DesignSfxDeepen("sfx_goblin_death", "RRR_NPC_sfx_death") }); } ((Character)component).m_deathEffects = new EffectList { m_effectPrefabs = list.ToArray() }; ((Character)component).m_waterEffects = CloneEffectList(((Character)component2).m_waterEffects); ((Character)component).m_slideEffects = CloneEffectList(((Character)component2).m_slideEffects); ((Character)component).m_jumpEffects = CloneEffectList(((Character)component2).m_jumpEffects); component.m_dropEffects = CloneEffectList(component2.m_dropEffects); component.m_consumeItemEffects = CloneEffectList(component2.m_consumeItemEffects); component.m_equipEffects = CloneEffectList(component2.m_equipEffects); component.m_perfectBlockEffect = CloneEffectList(component2.m_perfectBlockEffect); } private static GameObject DesignSfxDeepen(string originalName, string newName) { bool alreadyExisted = false; GameObject val = RRRPrefabLoader.CloneRepeatable(ref alreadyExisted, originalName, newName); if (alreadyExisted) { return val; } ZSFX component = val.GetComponent<ZSFX>(); component.m_minPitch = 0.8f; component.m_maxPitch = 0.9f; return val; } private static EffectList CloneEffectList(EffectList elPP) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //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_0040: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(object)new EffectData[elPP.m_effectPrefabs.Length]; for (int i = 0; i < elPP.m_effectPrefabs.Length; i++) { EffectData val2 = elPP.m_effectPrefabs[i]; val.m_effectPrefabs[i] = new EffectData { m_prefab = val2.m_prefab, m_enabled = val2.m_enabled, m_attach = val2.m_attach, m_inheritParentRotation = val2.m_inheritParentRotation, m_inheritParentScale = val2.m_inheritParentScale, m_randomRotation = val2.m_randomRotation, m_scale = val2.m_scale }; } return val; } internal static void MakePrefab() { DesignNpcBase(RRRPrefabLoader.Clone("Goblin", "RRR_NPC")); } } } namespace RRRCore.prefabs._0_2_0 { public class RRRCfgAppearance { public RRRMobDataUtil.Vector3 vScale = RRRMobDataUtil.one; public RRRMobDataUtil.Color cTintColor; public RRRMobDataUtil.Color cTintItems; public RRRMobDataUtil.Color cBodySmoke; public RRRMobDataUtil.Color cBodyFlames; public string sCustomTexture; internal static bool MakeAppearance(GameObject clone, RRRCfgAppearance cA) { if (cA.vScale.IsNotNull()) { DoScale(clone, cA); } SkinnedMeshRenderer[] componentsInChildren = clone.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer smr in componentsInChildren) { EditSmr(clone, cA, smr); } if (cA.cTintItems.IsNotNull()) { TintItems(clone, cA); } DoRagdoll(clone, cA); return true; } private static void EditSmr(GameObject clone, RRRCfgAppearance cA, SkinnedMeshRenderer smr) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0104: 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_0126: Unknown result type (might be due to invalid IL or missing references) if (!Utility.IsNullOrWhiteSpace(cA.sCustomTexture)) { if (RRRCustomMobDB.TryGetTexture(cA.sCustomTexture, out var texture)) { ((Renderer)smr).sharedMaterial = new Material(((Renderer)smr).sharedMaterial); ((Renderer)smr).sharedMaterial.mainTexture = (Texture)(object)texture; } else { DoMissingTextureError(clone, cA); } } if (cA.cTintColor.IsNotNull()) { ((Renderer)smr).material.color = cA.cTintColor.Make(); } if (cA.cBodySmoke.IsNotNull()) { GameObject val = Object.Instantiate<GameObject>(((Component)ZNetScene.instance.GetPrefab("Ghost").GetComponentsInChildren<ParticleSystem>().First((ParticleSystem w) => ((Object)((Component)w).gameObject).name == "black_smoke")).gameObject, ((Component)smr).transform); if (val.IsNotNull()) { ParticleSystem component = val.GetComponent<ParticleSystem>(); if (component.IsNotNull()) { ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).skinnedMeshRenderer = smr; ((Component)component).GetComponent<Renderer>().material.color = cA.cBodySmoke.Make(); } } } if (!cA.cBodyFlames.IsNotNull()) { return; } ParticleSystem[] componentsInChildren = ZNetScene.instance.GetPrefab("Surtling").GetComponentsInChildren<ParticleSystem>(); GameObject val2 = Object.Instantiate<GameObject>(((Component)componentsInChildren.First((ParticleSystem w) => ((Object)((Component)w).gameObject).name == "flames")).gameObject, ((Component)smr).transform); GameObject val3 = Object.Instantiate<GameObject>(((Component)componentsInChildren.First((ParticleSystem w) => ((Object)((Component)w).gameObject).name == "flames_world")).gameObject, ((Component)smr).transform); if (val2.IsNotNull() && val3.IsNotNull()) { ParticleSystem component2 = val2.GetComponent<ParticleSystem>(); if (component2.IsNotNull()) { DoFlames(component2, smr, cA); } ParticleSystem component3 =
plugins/MonsterLabZFix-MonsterLabZ/MonsterLabZ.dll
Decompiled 2 months 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.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CreatureManager; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using LocalizationManager; using LocationManager; using Microsoft.CodeAnalysis; using SoftReferenceableAssets; using TMPro; using UnityEngine; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: Guid("150BFDAF-FF35-4302-B7CC-BEDCE69118D5")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyProduct("MonsterLabZ")] [assembly: AssemblyCompany("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("https://valheim.thunderstore.io/package/MonsterLabZ/MonsterLabZ")] [assembly: AssemblyTitle("MonsterLabZ")] [assembly: AssemblyFileVersion("3.0.11")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.11.0")] [module: UnverifiableCode] namespace MonsterLabZ { public class Ship : MonoBehaviour { public enum Speed { Stop, Back, Slow, Half, Full } private bool m_forwardPressed; private bool m_backwardPressed; private float m_sendRudderTime; private Vector3 windChangeVelocity = Vector3.zero; private bool sailWasInPosition; [Header("Objects")] public GameObject m_sailObject; public GameObject m_mastObject; public GameObject m_rudderObject; public ShipControlls m_shipControlls; public Transform m_controlGuiPos; [Header("Misc")] public BoxCollider m_floatCollider; public float m_waterLevelOffset; public float m_forceDistance = 1f; public float m_force = 0.5f; public float m_damping = 0.05f; public float m_dampingSideway = 0.05f; public float m_dampingForward = 0.01f; public float m_angularDamping = 0.01f; public float m_disableLevel = -0.5f; public float m_sailForceOffset; public float m_sailForceFactor = 0.1f; public float m_rudderSpeed = 0.5f; public float m_stearForceOffset = -10f; public float m_stearForce = 0.5f; public float m_stearVelForceFactor = 0.1f; public float m_backwardForce = 50f; public float m_rudderRotationMax = 30f; public float m_rudderRotationSpeed = 30f; public float m_minWaterImpactForce = 2.5f; public float m_minWaterImpactInterval = 2f; public float m_waterImpactDamage = 10f; public float m_upsideDownDmgInterval = 1f; public float m_upsideDownDmg = 20f; public EffectList m_waterImpactEffect = new EffectList(); private Speed m_speed; private float m_rudder; private float m_rudderValue; private Vector3 m_sailForce = Vector3.zero; private List<BaseAI> m_players = new List<BaseAI>(); private static List<Ship> m_currentShips = new List<Ship>(); private Rigidbody m_body; private ZNetView m_nview; private Cloth m_sailCloth; private float m_lastDepth = -9999f; private float m_lastWaterImpactTime; private float m_upsideDownDmgTimer; private float m_rudderPaddleTimer; private void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); m_body = ((Component)this).GetComponent<Rigidbody>(); Humanoid component = ((Component)this).GetComponent<Humanoid>(); if (Object.op_Implicit((Object)(object)component)) { Humanoid val = component; ((Character)val).m_onDeath = (Action)Delegate.Combine(((Character)val).m_onDeath, new Action(OnDestroyed)); } if (m_nview.GetZDO() == null) { ((Behaviour)this).enabled = false; } m_body.maxDepenetrationVelocity = 2f; Heightmap.ForceGenerateAll(); m_sailCloth = m_sailObject.GetComponentInChildren<Cloth>(); } public bool CanBeRemoved() { return m_players.Count > 0; } private void Start() { m_nview.Register("Stop", (Action<long>)RPC_Stop); m_nview.Register("Forward", (Action<long>)RPC_Forward); m_nview.Register("Backward", (Action<long>)RPC_Backward); m_nview.Register<float>("Rudder", (Action<long, float>)RPC_Rudder); ((MonoBehaviour)this).InvokeRepeating("UpdateOwner", 2f, 2f); } private void PrintStats() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (m_players.Count != 0) { Vector3 velocity = m_body.velocity; ZLog.Log((object)("Vel:" + ((Vector3)(ref velocity)).magnitude.ToString("0.0"))); } } public void ApplyControlls(Vector3 dir) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) bool flag = (double)dir.z > 0.5; bool flag2 = (double)dir.z < -0.5; if (flag && !m_forwardPressed) { Forward(); } if (flag2 && !m_backwardPressed) { Backward(); } float fixedDeltaTime = Time.fixedDeltaTime; float num = Mathf.Lerp(0.5f, 1f, Mathf.Abs(m_rudderValue)); m_rudder = dir.x * num; m_rudderValue += m_rudder * m_rudderSpeed * fixedDeltaTime; m_rudderValue = Mathf.Clamp(m_rudderValue, -1f, 1f); if ((double)Time.time - (double)m_sendRudderTime > 0.20000000298023224) { m_sendRudderTime = Time.time; m_nview.InvokeRPC("Rudder", new object[1] { m_rudderValue }); } m_forwardPressed = flag; m_backwardPressed = flag2; } public void Forward() { m_nview.InvokeRPC("Forward", Array.Empty<object>()); } public void Backward() { m_nview.InvokeRPC("Backward", Array.Empty<object>()); } public void Rudder(float rudder) { ((MonoBehaviour)m_nview).Invoke("Rudder", rudder); } private void RPC_Rudder(long sender, float value) { m_rudderValue = value; } public void Stop() { m_nview.InvokeRPC("Stop", Array.Empty<object>()); } private void RPC_Stop(long sender) { m_speed = Speed.Stop; } private void RPC_Forward(long sender) { switch (m_speed) { case Speed.Stop: m_speed = Speed.Slow; break; case Speed.Back: m_speed = Speed.Stop; break; case Speed.Slow: m_speed = Speed.Half; break; case Speed.Half: m_speed = Speed.Full; break; } } private void RPC_Backward(long sender) { switch (m_speed) { case Speed.Stop: m_speed = Speed.Back; break; case Speed.Slow: m_speed = Speed.Stop; break; case Speed.Half: m_speed = Speed.Slow; break; case Speed.Full: m_speed = Speed.Half; break; case Speed.Back: break; } } private void FixedUpdate() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: 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_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: 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_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_0749: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_075a: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0780: Unknown result type (might be due to invalid IL or missing references) //IL_0785: Unknown result type (might be due to invalid IL or missing references) //IL_07f5: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_07fe: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Unknown result type (might be due to invalid IL or missing references) //IL_07c4: Unknown result type (might be due to invalid IL or missing references) //IL_07cf: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Unknown result type (might be due to invalid IL or missing references) //IL_07e7: Unknown result type (might be due to invalid IL or missing references) //IL_07ec: Unknown result type (might be due to invalid IL or missing references) UpdateControlls(Time.fixedDeltaTime); UpdateSail(Time.fixedDeltaTime); if (Object.op_Implicit((Object)(object)m_nview) && !m_nview.IsOwner()) { return; } UpdateUpsideDmg(Time.fixedDeltaTime); if (m_players.Count == 0) { m_speed = Speed.Full; m_rudderValue = 0f; } float num = 1f; Vector3 worldCenterOfMass = m_body.worldCenterOfMass; Vector3 val = ((Component)m_floatCollider).transform.position + ((Component)m_floatCollider).transform.forward * m_floatCollider.size.z / 2f; Vector3 val2 = ((Component)m_floatCollider).transform.position - ((Component)m_floatCollider).transform.forward * m_floatCollider.size.z / 2f; Vector3 val3 = ((Component)m_floatCollider).transform.position - ((Component)m_floatCollider).transform.right * m_floatCollider.size.x / 2f; Vector3 val4 = ((Component)m_floatCollider).transform.position + ((Component)m_floatCollider).transform.right * m_floatCollider.size.x / 2f; double num2 = Floating.GetLiquidLevel(worldCenterOfMass, num, (LiquidType)10); float liquidLevel = Floating.GetLiquidLevel(val3, num, (LiquidType)10); float liquidLevel2 = Floating.GetLiquidLevel(val4, num, (LiquidType)10); float liquidLevel3 = Floating.GetLiquidLevel(val, num, (LiquidType)10); float liquidLevel4 = Floating.GetLiquidLevel(val2, num, (LiquidType)10); double num3 = liquidLevel; float num4 = (float)((num2 + num3 + (double)liquidLevel2 + (double)liquidLevel3 + (double)liquidLevel4) / 5.0); float num5 = worldCenterOfMass.y - num4 - m_waterLevelOffset; if (!((double)num5 > (double)m_disableLevel)) { m_body.WakeUp(); UpdateWaterForce(num5, Time.fixedDeltaTime); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(val3.x, liquidLevel, val3.z); Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(val4.x, liquidLevel2, val4.z); Vector3 val7 = default(Vector3); ((Vector3)(ref val7))..ctor(val.x, liquidLevel3, val.z); Vector3 val8 = default(Vector3); ((Vector3)(ref val8))..ctor(val2.x, liquidLevel4, val2.z); float fixedDeltaTime = Time.fixedDeltaTime; float num6 = fixedDeltaTime * 50f; float num7 = Mathf.Clamp01(Mathf.Abs(num5) / m_forceDistance); m_body.AddForceAtPosition(Vector3.up * m_force * num7 * num6, worldCenterOfMass, (ForceMode)2); float num8 = Vector3.Dot(m_body.velocity, ((Component)this).transform.forward); float num9 = Vector3.Dot(m_body.velocity, ((Component)this).transform.right); Vector3 velocity = m_body.velocity; float num10 = velocity.y * velocity.y * Mathf.Sign(velocity.y) * m_damping * num7; float num11 = num8 * num8 * Mathf.Sign(num8) * m_dampingForward * num7; float num12 = num9 * num9 * Mathf.Sign(num9) * m_dampingSideway * num7; velocity.y -= Mathf.Clamp(num10, -1f, 1f); Vector3 velocity2 = velocity - ((Component)this).transform.forward * Mathf.Clamp(num11, -1f, 1f) - ((Component)this).transform.right * Mathf.Clamp(num12, -1f, 1f); double num13 = ((Vector3)(ref velocity2)).magnitude; Vector3 velocity3 = m_body.velocity; if (num13 > (double)((Vector3)(ref velocity3)).magnitude) { Vector3 normalized = ((Vector3)(ref velocity2)).normalized; velocity3 = m_body.velocity; velocity2 = normalized * ((Vector3)(ref velocity3)).magnitude; } if (m_players.Count < 0) { velocity2.x *= 0.1f; velocity2.z *= 0.1f; } m_body.velocity = velocity2; Rigidbody body = m_body; body.angularVelocity -= m_body.angularVelocity * m_angularDamping * num7; float num14 = 0.15f; float num15 = 0.5f; float num16 = Mathf.Clamp((val7.y - val.y) * num14, 0f - num15, num15); float num17 = Mathf.Clamp((val8.y - val2.y) * num14, 0f - num15, num15); float num18 = Mathf.Clamp((val5.y - val3.y) * num14, 0f - num15, num15); float num19 = Mathf.Clamp((val6.y - val4.y) * num14, 0f - num15, num15); float num20 = Mathf.Sign(num16) * Mathf.Abs(Mathf.Pow(num16, 2f)); float num21 = Mathf.Sign(num17) * Mathf.Abs(Mathf.Pow(num17, 2f)); float num22 = Mathf.Sign(num18) * Mathf.Abs(Mathf.Pow(num18, 2f)); float num23 = Mathf.Sign(num19) * Mathf.Abs(Mathf.Pow(num19, 2f)); m_body.AddForceAtPosition(Vector3.up * num20 * num6, val, (ForceMode)2); m_body.AddForceAtPosition(Vector3.up * num21 * num6, val2, (ForceMode)2); m_body.AddForceAtPosition(Vector3.up * num22 * num6, val3, (ForceMode)2); m_body.AddForceAtPosition(Vector3.up * num23 * num6, val4, (ForceMode)2); float sailSize = 0f; if (m_speed == Speed.Full) { sailSize = 1f; } else if (m_speed == Speed.Half) { sailSize = 0.5f; } m_body.AddForceAtPosition(GetSailForce(sailSize, fixedDeltaTime), worldCenterOfMass + ((Component)this).transform.up * m_sailForceOffset, (ForceMode)2); Vector3 val9 = ((Component)this).transform.position + ((Component)this).transform.forward * m_stearForceOffset; m_body.AddForceAtPosition(((Component)this).transform.right * (num8 * m_stearVelForceFactor) * (0f - m_rudderValue) * fixedDeltaTime, val9, (ForceMode)2); Vector3 val10 = Vector3.zero; switch (m_speed) { case Speed.Back: val10 += -((Component)this).transform.forward * m_backwardForce * (1f - Mathf.Abs(m_rudderValue)); break; case Speed.Slow: val10 += ((Component)this).transform.forward * m_backwardForce * (1f - Mathf.Abs(m_rudderValue)); break; } if (m_speed == Speed.Back || m_speed == Speed.Slow) { float num24 = ((m_speed == Speed.Back) ? (-1f) : 1f); val10 += ((Component)this).transform.right * m_stearForce * (0f - m_rudderValue) * num24; } m_body.AddForceAtPosition(val10 * fixedDeltaTime, val9, (ForceMode)2); ApplyEdgeForce(Time.fixedDeltaTime); } } private void UpdateUpsideDmg(float dt) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown if ((double)((Component)this).transform.up.y >= 0.0) { return; } m_upsideDownDmgTimer += dt; if (!((double)m_upsideDownDmgTimer <= (double)m_upsideDownDmgInterval)) { m_upsideDownDmgTimer = 0f; IDestructible component = ((Component)this).GetComponent<IDestructible>(); if (component != null) { component.Damage(new HitData { m_damage = { m_blunt = m_upsideDownDmg }, m_point = ((Component)this).transform.position, m_dir = Vector3.up }); } } } private Vector3 GetSailForce(float sailSize, float dt) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_005a: 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_0075: 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) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Vector3 windDir = EnvMan.instance.GetWindDir(); float num = Mathf.Lerp(0.25f, 1f, EnvMan.instance.GetWindIntensity()); float num2 = GetWindAngleFactor() * num; Vector3 forward = ((Component)this).transform.forward; m_sailForce = Vector3.SmoothDamp(m_sailForce, Vector3.Normalize(windDir + forward) * num2 * m_sailForceFactor * sailSize, ref windChangeVelocity, 1f, 99f); return m_sailForce; } public float GetWindAngleFactor() { //IL_0006: 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_0016: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Dot(EnvMan.instance.GetWindDir(), -((Component)this).transform.forward); return Mathf.Lerp(0.7f, 1f, 1f - Mathf.Abs(num)) * (1f - Utils.LerpStep(0.75f, 0.8f, num)); } private void UpdateWaterForce(float depth, float dt) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown if ((double)m_lastDepth == -9999.0) { m_lastDepth = depth; return; } double num = (double)depth - (double)m_lastDepth; m_lastDepth = depth; double num2 = dt; float num3 = (float)(num / num2); if ((double)num3 > 0.0 || (double)Mathf.Abs(num3) <= (double)m_minWaterImpactForce || (double)Time.time - (double)m_lastWaterImpactTime <= (double)m_minWaterImpactInterval) { return; } m_lastWaterImpactTime = Time.time; m_waterImpactEffect.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); if (m_players.Count > 0) { IDestructible component = ((Component)this).GetComponent<IDestructible>(); if (component != null) { component.Damage(new HitData { m_damage = { m_blunt = m_waterImpactDamage }, m_point = ((Component)this).transform.position, m_dir = Vector3.up }); } } } private void ApplyEdgeForce(float dt) { //IL_0007: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; float magnitude = ((Vector3)(ref position)).magnitude; float num = 10420f; if (!((double)magnitude <= (double)num)) { m_body.AddForce(Vector3.Normalize(((Component)this).transform.position) * (Utils.LerpStep(num, 10500f, magnitude) * 8f) * dt, (ForceMode)2); } } private void FixTilt() { //IL_0007: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Asin(((Component)this).transform.right.y); float num2 = Mathf.Asin(((Component)this).transform.forward.y); if ((double)Mathf.Abs(num) > 0.5235987901687622) { if ((double)num > 0.0) { ((Component)this).transform.RotateAround(((Component)this).transform.position, ((Component)this).transform.forward, (float)((0.0 - (double)Time.fixedDeltaTime) * 20.0)); } else { ((Component)this).transform.RotateAround(((Component)this).transform.position, ((Component)this).transform.forward, Time.fixedDeltaTime * 20f); } } if (!((double)Mathf.Abs(num2) <= 0.5235987901687622)) { if ((double)num2 > 0.0) { ((Component)this).transform.RotateAround(((Component)this).transform.position, ((Component)this).transform.right, (float)((0.0 - (double)Time.fixedDeltaTime) * 20.0)); } else { ((Component)this).transform.RotateAround(((Component)this).transform.position, ((Component)this).transform.right, Time.fixedDeltaTime * 20f); } } } private void UpdateControlls(float dt) { if (m_nview.IsOwner()) { m_nview.GetZDO().Set("forward", (int)m_speed); m_nview.GetZDO().Set("rudder", m_rudderValue); return; } m_speed = (Speed)m_nview.GetZDO().GetInt("forward", 0); if (!((double)Time.time - (double)m_sendRudderTime <= 1.0)) { m_rudderValue = m_nview.GetZDO().GetFloat("rudder", 0f); } } public bool IsSailUp() { return m_speed == Speed.Half || m_speed == Speed.Full; } private void UpdateSail(float dt) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00c1: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) UpdateSailSize(dt); Vector3 val = Vector3.Cross(Vector3.Cross(EnvMan.instance.GetWindDir(), ((Component)this).transform.up), ((Component)this).transform.up); if (m_speed == Speed.Full || m_speed == Speed.Half) { float num = (float)(0.5 + (double)Vector3.Dot(((Component)this).transform.forward, val) * 0.5); m_mastObject.transform.rotation = Quaternion.RotateTowards(m_mastObject.transform.rotation, Quaternion.LookRotation(-Vector3.Lerp(val, Vector3.Normalize(val - ((Component)this).transform.forward), num), ((Component)this).transform.up), 30f * dt); } else if (m_speed == Speed.Back) { m_mastObject.transform.rotation = Quaternion.RotateTowards(m_mastObject.transform.rotation, Quaternion.RotateTowards(Quaternion.LookRotation(-((Component)this).transform.forward, ((Component)this).transform.up), Quaternion.LookRotation(-val, ((Component)this).transform.up), 80f), 30f * dt); } } private void UpdateRudder(float dt, bool HasPlayerOnboard) { //IL_0030: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00d5: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m_rudderObject)) { return; } Quaternion val = Quaternion.Euler(0f, m_rudderRotationMax * (0f - m_rudderValue), 0f); if (HasPlayerOnboard) { if (m_speed == Speed.Full) { m_rudderPaddleTimer += dt; val *= Quaternion.Euler(0f, Mathf.Sin(m_rudderPaddleTimer * 6f) * 20f, 0f); } else if (m_speed == Speed.Back) { m_rudderPaddleTimer += dt; val *= Quaternion.Euler(0f, Mathf.Sin(m_rudderPaddleTimer * -3f) * 40f, 0f); } } m_rudderObject.transform.localRotation = Quaternion.Slerp(m_rudderObject.transform.localRotation, val, 0.5f); } private void UpdateSailSize(float dt) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) float num = 0f; switch (m_speed) { case Speed.Stop: num = 0.1f; break; case Speed.Back: num = 0.1f; break; case Speed.Slow: num = 0.1f; break; case Speed.Half: num = 0.5f; break; case Speed.Full: num = 1f; break; } Vector3 localScale = m_sailObject.transform.localScale; bool flag = (double)Mathf.Abs(localScale.y - num) < 0.009999999776482582; if (!flag) { localScale.y = Mathf.MoveTowards(localScale.y, num, dt); m_sailObject.transform.localScale = localScale; } if (Object.op_Implicit((Object)(object)m_sailCloth)) { if (m_speed == Speed.Stop || m_speed == Speed.Slow || m_speed == Speed.Back) { if (flag && m_sailCloth.enabled) { m_sailCloth.enabled = false; } } else if (flag) { if (!sailWasInPosition) { m_sailCloth.enabled = false; m_sailCloth.enabled = true; } } else { m_sailCloth.enabled = true; } } sailWasInPosition = flag; } private void OnTriggerEnter(Collider collider) { BaseAI component = ((Component)collider).GetComponent<BaseAI>(); if (Object.op_Implicit((Object)(object)component)) { m_players.Add(component); if ((Object)(object)component == (Object)(object)((Component)this).gameObject.GetComponent<BaseAI>()) { m_currentShips.Add(this); } } } private void OnTriggerExit(Collider collider) { BaseAI component = ((Component)collider).GetComponent<BaseAI>(); if (Object.op_Implicit((Object)(object)component)) { m_players.Remove(component); if ((Object)(object)component == (Object)(object)((Component)this).gameObject.GetComponent<Humanoid>()) { m_currentShips.Remove(this); } } } public bool IsPlayerInBoat(BaseAI baseAI) { return m_players.Contains(baseAI); } public bool HasPlayerOnboard() { return m_players.Count > 0; } private void OnDestroyed() { if (m_nview.IsValid() && m_nview.IsOwner()) { m_currentShips.Remove(this); } } public static Ship GetLocalShip() { return (m_currentShips.Count != 0) ? m_currentShips[m_currentShips.Count - 1] : null; } public bool HaveControllingPlayer() { return m_players.Count != 0 && m_shipControlls.HaveValidUser(); } public bool IsOwner() { return m_nview.IsValid() && m_nview.IsOwner(); } public float GetSpeed() { //IL_0006: 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) return Vector3.Dot(m_body.velocity, ((Component)this).transform.forward); } public Speed GetSpeedSetting() { return m_speed; } public float GetRudder() { return m_rudder; } public float GetRudderValue() { return m_rudderValue; } public float GetShipYawAngle() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) Camera mainCamera = Utils.GetMainCamera(); return ((Object)(object)mainCamera == (Object)null) ? 0f : (0f - Utils.YawFromDirection(((Component)mainCamera).transform.InverseTransformDirection(((Component)this).transform.forward))); } public float GetWindAngle() { //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) return 0f - Utils.YawFromDirection(((Component)this).transform.InverseTransformDirection(EnvMan.instance.GetWindDir())); } private void OnDrawGizmosSelected() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position + ((Component)this).transform.forward * m_stearForceOffset, 0.25f); Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(((Component)this).transform.position + ((Component)this).transform.up * m_sailForceOffset, 0.25f); } } public class AIShipEffects : MonoBehaviour { public Transform m_shadow; public float m_offset = 0.01f; public float m_minimumWakeVel = 5f; public GameObject m_speedWakeRoot; public GameObject m_wakeSoundRoot; public GameObject m_inWaterSoundRoot; public float m_audioFadeDuration = 2f; public AudioSource m_sailSound; public float m_sailFadeDuration = 1f; public GameObject m_splashEffects; private float m_sailBaseVol = 1f; private ParticleSystem[] m_wakeParticles; private List<KeyValuePair<AudioSource, float>> m_wakeSounds = new List<KeyValuePair<AudioSource, float>>(); private List<KeyValuePair<AudioSource, float>> m_inWaterSounds = new List<KeyValuePair<AudioSource, float>>(); private Rigidbody m_body; private Ship m_ship; private void Awake() { ZNetView componentInParent = ((Component)this).GetComponentInParent<ZNetView>(); if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.GetZDO() == null) { ((Behaviour)this).enabled = false; return; } m_body = ((Component)this).GetComponentInParent<Rigidbody>(); m_ship = ((Component)this).GetComponentInParent<Ship>(); if (Object.op_Implicit((Object)(object)m_speedWakeRoot)) { m_wakeParticles = m_speedWakeRoot.GetComponentsInChildren<ParticleSystem>(); } if (Object.op_Implicit((Object)(object)m_wakeSoundRoot)) { AudioSource[] componentsInChildren = m_wakeSoundRoot.GetComponentsInChildren<AudioSource>(); foreach (AudioSource val in componentsInChildren) { val.pitch = Random.Range(0.9f, 1.1f); m_wakeSounds.Add(new KeyValuePair<AudioSource, float>(val, val.volume)); } } if (Object.op_Implicit((Object)(object)m_inWaterSoundRoot)) { AudioSource[] componentsInChildren2 = m_inWaterSoundRoot.GetComponentsInChildren<AudioSource>(); foreach (AudioSource val2 in componentsInChildren2) { val2.pitch = Random.Range(0.9f, 1.1f); m_inWaterSounds.Add(new KeyValuePair<AudioSource, float>(val2, val2.volume)); } } if (Object.op_Implicit((Object)(object)m_sailSound)) { m_sailBaseVol = m_sailSound.volume; m_sailSound.pitch = Random.Range(0.9f, 1.1f); } } private void LateUpdate() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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) float liquidLevel = Floating.GetLiquidLevel(((Component)this).transform.position, 1f, (LiquidType)10); Vector3 position = ((Component)this).transform.position; float deltaTime = Time.deltaTime; if ((double)position.y > (double)liquidLevel) { SetWake(enabled: false, deltaTime); FadeSounds(m_inWaterSounds, enabled: false, deltaTime); return; } Vector3 velocity = m_body.velocity; bool enabled = (double)((Vector3)(ref velocity)).magnitude > (double)m_minimumWakeVel; FadeSounds(m_inWaterSounds, enabled: true, deltaTime); SetWake(enabled, deltaTime); if (Object.op_Implicit((Object)(object)m_sailSound)) { FadeSound(m_sailSound, m_ship.IsSailUp() ? m_sailBaseVol : 0f, m_sailFadeDuration, deltaTime); } } private void SetWake(bool enabled, float dt) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] wakeParticles = m_wakeParticles; foreach (ParticleSystem val in wakeParticles) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = enabled; } FadeSounds(m_wakeSounds, enabled, dt); } private void FadeSounds(List<KeyValuePair<AudioSource, float>> sources, bool enabled, float dt) { foreach (KeyValuePair<AudioSource, float> source in sources) { if (enabled) { FadeSound(source.Key, source.Value, m_audioFadeDuration, dt); } else { FadeSound(source.Key, 0f, m_audioFadeDuration, dt); } } } private void FadeSound(AudioSource source, float target, float fadeDuration, float dt) { float num = dt / fadeDuration; if ((double)target > 0.0) { if (!source.isPlaying) { source.Play(); } source.volume = Mathf.MoveTowards(source.volume, target, num); } else if (source.isPlaying) { source.volume = Mathf.MoveTowards(source.volume, 0f, num); if (!((double)source.volume > 0.0)) { source.Stop(); } } } } public static class CommonResources { public static GameObject DwarfGoblinSpear; public static ItemData DwarfGoblinSpearData; public static void FindCommonResources() { DwarfGoblinSpear = ZNetScene.instance?.m_prefabs.Where((GameObject p) => ((Object)p).name == "DwarfGoblinSpear").FirstOrDefault(); GameObject dwarfGoblinSpear = DwarfGoblinSpear; DwarfGoblinSpearData = ((dwarfGoblinSpear != null) ? dwarfGoblinSpear.GetComponent<ItemDrop>().m_itemData : null); } } public class AmbienceSpawn : MonoBehaviour { private const float m_minPlayerDistance = 250f; private const float m_blockedMinTime = 4f; public GameObject m_AmbientPrefab; public float m_interval = 0.5f; private float m_lastSpawnTime; private float m_time; private void Start() { m_time = Random.Range(0f, m_interval); } private void Update() { m_time += Time.deltaTime; if (!((double)m_time <= (double)m_interval)) { m_time = 0f; Spawn(); } } private void Spawn() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (double)Vector3.Distance(((Component)localPlayer).transform.position, ((Component)this).transform.position) > 250.0) { m_lastSpawnTime = Time.time; return; } Object.Instantiate<GameObject>(m_AmbientPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation); m_lastSpawnTime = Time.time; } } public class BillboardMove : MonoBehaviour { public float scrollSpeed = 0.5f; public Renderer rend; private void Start() { rend = ((Component)this).GetComponent<Renderer>(); } private void Update() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) rend.material.SetTextureOffset("_MainTex", new Vector2(Time.time * scrollSpeed, 0f)); } } public class RotateTor : MonoBehaviour { public float TorRotationSpeed; private void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0054: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.AngleAxis(TorRotationSpeed * Time.deltaTime, Vector3.down); Quaternion val2 = Quaternion.AngleAxis(TorRotationSpeed * Time.deltaTime, Vector3.down); Transform transform = ((Component)this).transform; transform.rotation *= val; Transform transform2 = ((Component)this).transform; transform2.rotation *= val2; } } public class RotateTor1 : MonoBehaviour { public float TorRotationSpeed; private void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0054: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.AngleAxis(TorRotationSpeed * Time.deltaTime, Vector3.down); Quaternion val2 = Quaternion.AngleAxis(TorRotationSpeed * Time.deltaTime, Vector3.down); Transform transform = ((Component)this).transform; transform.rotation *= val; Transform transform2 = ((Component)this).transform; transform2.rotation *= val2; } } public class SetTextureOffset : MonoBehaviour { public Vector2 offsetValue; public Renderer rend; private void Start() { rend = ((Component)this).GetComponent<Renderer>(); ((MonoBehaviour)this).StartCoroutine(MoveTheTexture()); } private IEnumerator MoveTheTexture() { while (true) { yield return (object)new WaitForSeconds(5f); offsetValue = rend.material.GetTextureOffset("_MainTex"); offsetValue.y += 1f / 3f; rend.material.SetTextureOffset("_MainTex", new Vector2(offsetValue.x, offsetValue.y)); } } } public class TorGravity : MonoBehaviour { public float ForceGN; public float BodyKf; private HashSet<Rigidbody> affectedBod = new HashSet<Rigidbody>(); private Rigidbody componRigidbody; private void Start() { componRigidbody = ((Component)this).GetComponent<Rigidbody>(); } private void OnTriggerEnter(Collider other) { if ((Object)(object)other.attachedRigidbody != (Object)null) { affectedBod.Add(other.attachedRigidbody); } } private void OnTriggerExit(Collider other) { if ((Object)(object)other.attachedRigidbody != (Object)null) { affectedBod.Remove(other.attachedRigidbody); } } private void FixedUpdate() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) foreach (Rigidbody item in affectedBod) { Vector3 val = ((Component)this).transform.position - item.position; Vector3 val2 = ((Component)this).transform.position - item.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; float num = ForceGN * (item.mass - componRigidbody.mass) / sqrMagnitude; item.AddForce(val * num * BodyKf); } } } public class TornadoGravity : MonoBehaviour { public float ForceG; public float BodyKoeff; public float OrbitSpeed; private HashSet<Rigidbody> affectedBodies = new HashSet<Rigidbody>(); private Rigidbody componentRigidbody; private void Start() { componentRigidbody = ((Component)this).GetComponent<Rigidbody>(); } private void OnTriggerEnter(Collider other) { if ((Object)(object)other.attachedRigidbody != (Object)null) { affectedBodies.Add(other.attachedRigidbody); } } private void OnTriggerExit(Collider other) { if ((Object)(object)other.attachedRigidbody != (Object)null) { affectedBodies.Remove(other.attachedRigidbody); } } private void FixedUpdate() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) foreach (Rigidbody affectedBody in affectedBodies) { Vector3 val = ((Component)this).transform.position - affectedBody.position; Vector3 normalized = ((Vector3)(ref val)).normalized; val = ((Component)this).transform.position - affectedBody.position; float magnitude = ((Vector3)(ref val)).magnitude; float num = (float)((double)ForceG * (double)affectedBody.mass * (double)componentRigidbody.mass / ((double)magnitude * (double)magnitude)); affectedBody.AddForce(normalized * num * BodyKoeff); ((Component)affectedBody).transform.RotateAround(Vector3.zero, Vector3.down, (float)(10.0 * (double)OrbitSpeed * 120.0)); } } } public class WaterSafing : MonoBehaviour { public float power; private void Start() { } private void Update() { } private void OnTriggerStay(Collider col) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (((Component)col).tag == "Physical") { ((Component)col).GetComponent<Rigidbody>().AddForce(((Component)this).transform.up * power); } if (((Component)col).tag == "Player") { if (Input.GetKey((KeyCode)32)) { ((Component)col).GetComponent<CharacterController>().skinWidth = 3f; } else { ((Component)col).GetComponent<CharacterController>().skinWidth = 0.08f; } } } private void OnTriggerExit(Collider col) { if (((Component)col).tag == "Player") { ((Component)col).GetComponent<CharacterController>().skinWidth = 0.08f; } } } public class ML_PlantGrow : SlowUpdate, Hoverable { public string m_name = "Plant"; public float m_growTime = 10f; public float m_growTimeMax = 2000f; public GameObject[] m_grownPrefabs = (GameObject[])(object)new GameObject[0]; public float m_minScale = 1f; public float m_maxScale = 1f; public float m_growRadius = 1f; public bool m_destroyIfCantGrow; [SerializeField] private GameObject m_healthy; [SerializeField] private GameObject m_healthyGrown; public EffectList m_growEffect = new EffectList(); private Status m_status; private ZNetView m_nview; private float m_updateTime; private float m_spawnTime; public override void Awake() { ((SlowUpdate)this).Awake(); m_nview = ((Component)this).gameObject.GetComponent<ZNetView>(); if (m_nview.GetZDO() != null) { if (m_nview.IsOwner() && m_nview.GetZDO().GetLong("plantTime", 0L) == 0) { m_nview.GetZDO().Set("plantTime", ZNet.instance.GetTime().Ticks); } m_spawnTime = Time.time; } } public string GetHoverText() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return ((int)m_status == 0) ? Localization.instance.Localize(m_name + " ( $piece_plant_healthy )") : ""; } public string GetHoverName() { return Localization.instance.Localize(m_name); } private double TimeSincePlanted() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong("plantTime", ZNet.instance.GetTime().Ticks)); return (ZNet.instance.GetTime() - dateTime).TotalSeconds; } public virtual void SUpdate() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Invalid comparison between Unknown and I4 if (m_nview.IsValid() && !((double)Time.time - (double)m_updateTime < 10.0)) { m_updateTime = Time.time; double num = TimeSincePlanted(); UpdateHealth(num); float growTime = GetGrowTime(); if (Object.op_Implicit((Object)(object)m_healthyGrown)) { bool flag = num > (double)growTime * 0.5; m_healthy.SetActive(!flag && (int)m_status == 0); m_healthyGrown.SetActive(flag && (int)m_status == 0); } else { m_healthy.SetActive((int)m_status == 0); } if (m_nview.IsOwner() && !((double)Time.time - (double)m_spawnTime <= 10.0) && !(num <= (double)growTime)) { Grow(); } } } private float GetGrowTime() { //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_000d: Unknown result type (might be due to invalid IL or missing references) State state = Random.state; float value = Random.value; Random.state = state; return Mathf.Lerp(m_growTime, m_growTimeMax, value); } private void Grow() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0075: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if ((int)m_status > 0) { if (m_destroyIfCantGrow) { Destroy(); } return; } GameObject val = m_grownPrefabs[Random.Range(0, m_grownPrefabs.Length)]; Quaternion val2 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); Vector3 position = ((Component)this).transform.position; Quaternion val3 = val2; GameObject val4 = Object.Instantiate<GameObject>(val, position, val3); ZNetView component = val4.GetComponent<ZNetView>(); float num = Random.Range(m_minScale, m_maxScale); Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(num, num, num); component.SetLocalScale(localScale); TreeBase component2 = val4.GetComponent<TreeBase>(); if (Object.op_Implicit((Object)(object)component2)) { component2.Grow(); } m_nview.Destroy(); m_growEffect.Create(((Component)this).transform.position, val2, (Transform)null, num, -1); } private void UpdateHealth(double timeSincePlanted) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!(timeSincePlanted >= 10.0)) { m_status = (Status)0; } } private void Destroy() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown IDestructible component = ((Component)this).GetComponent<IDestructible>(); if (component != null) { component.Damage(new HitData { m_damage = { m_damage = 9999f } }); } } private Status GetStatus() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return m_status; } } public class HitAreaSFX : MonoBehaviour, IDestructible { public Action<HitData, HitAreaSFX> m_onHit; public float m_health = 100000f; [NonSerialized] public GameObject m_parentObject; public float m_hitNoise; public EffectList m_hitEffect = new EffectList(); public DestructibleType GetDestructibleType() { return (DestructibleType)1; } public void Damage(HitData hit) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if ((double)hit.GetTotalDamage() <= 0.0) { return; } m_hitEffect.Create(hit.m_point, Quaternion.identity, ((Component)this).transform, 1f, -1); if ((double)m_hitNoise > 0.0) { Player closestPlayer = Player.GetClosestPlayer(hit.m_point, 10f); if (Object.op_Implicit((Object)(object)closestPlayer)) { ((Character)closestPlayer).AddNoise(m_hitNoise); } } if (m_onHit != null) { m_onHit(hit, this); } } } public class InstantiatePrefabBoatKinematic : MonoBehaviour { public List<GameObject> m_spawnPrefab; private List<GameObject> m_spawnedMobs = new List<GameObject>(); public bool m_attach; public bool m_moveToTop; public void Start() { //IL_0025: 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) foreach (GameObject item in m_spawnPrefab) { GameObject val = Object.Instantiate<GameObject>(item, ((Component)((Component)this).transform).transform.position, ((Component)((Component)this).transform).transform.rotation); val.transform.SetParent(((Component)this).transform, true); m_spawnedMobs.Add(val); } } public void OnDestroy() { foreach (GameObject spawnedMob in m_spawnedMobs) { if ((Object)(object)spawnedMob != (Object)null) { spawnedMob.transform.parent = null; spawnedMob.GetComponent<Rigidbody>().isKinematic = false; } } } } public class InstantiatePrefabBoat : MonoBehaviour { public List<GameObject> m_spawnPrefab; private List<GameObject> m_spawnedMobs = new List<GameObject>(); public bool m_attach; public bool m_moveToTop; public void Start() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) ZLog.Log((object)(((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "()")); foreach (GameObject item in m_spawnPrefab) { ZLog.Log((object)("[" + ((object)this).GetType().Name + "] Spawning " + ((Object)item).name)); GameObject val = Object.Instantiate<GameObject>(item, ((Component)((Component)this).transform).transform.position, ((Component)((Component)this).transform).transform.rotation); val.transform.SetParent(((Component)this).transform, true); m_spawnedMobs.Add(val); } } public void OnDestroy() { ZLog.Log((object)(((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "()")); foreach (GameObject spawnedMob in m_spawnedMobs) { if ((Object)(object)spawnedMob != (Object)null) { ZLog.Log((object)("[" + ((object)this).GetType().Name + "] Reparent " + ((Object)spawnedMob).name)); spawnedMob.transform.parent = null; } } } } public class InstantiatePrefabSpawn : MonoBehaviour { public List<GameObject> m_spawnPrefab; private List<GameObject> m_spawnedMobs = new List<GameObject>(); public bool m_attach; public bool m_moveToTop; public void Start() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) ZLog.Log((object)(((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "()")); foreach (GameObject item in m_spawnPrefab) { ZLog.Log((object)("[" + ((object)this).GetType().Name + "] Spawning " + ((Object)item).name)); GameObject val = Object.Instantiate<GameObject>(item, ((Component)((Component)this).transform).transform.position, ((Component)((Component)this).transform).transform.rotation); val.transform.SetParent(((Component)this).transform, true); val.layer = 17; m_spawnedMobs.Add(val); } } public void OnDestroy() { ZLog.Log((object)(((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "()")); foreach (GameObject spawnedMob in m_spawnedMobs) { if ((Object)(object)spawnedMob != (Object)null) { ZLog.Log((object)("[" + ((object)this).GetType().Name + "] Reparent " + ((Object)spawnedMob).name)); spawnedMob.transform.parent = null; spawnedMob.GetComponent<Rigidbody>().isKinematic = false; spawnedMob.layer = 9; Humanoid component = spawnedMob.GetComponent<Humanoid>(); if ((Object)(object)component != (Object)null) { component.m_rightItem = CommonResources.DwarfGoblinSpearData; component.m_inventory.m_inventory[0] = CommonResources.DwarfGoblinSpearData; ((Character)component).m_turnSpeed = 300f; ((Character)component).m_runTurnSpeed = 100f; } } } } } public class InstantiatePrefabLoxRider : MonoBehaviour { public List<GameObject> m_spawnPrefab; private List<GameObject> m_spawnedMobs = new List<GameObject>(); public bool m_attach; public bool m_moveToTop; public void Start() { //IL_0025: 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) foreach (GameObject item in m_spawnPrefab) { GameObject val = Object.Instantiate<GameObject>(item, ((Component)((Component)this).transform).transform.position, ((Component)((Component)this).transform).transform.rotation); val.transform.SetParent(((Component)this).transform, true); val.layer = 17; m_spawnedMobs.Add(val); } } public void OnDestroy() { foreach (GameObject spawnedMob in m_spawnedMobs) { if ((Object)(object)spawnedMob != (Object)null) { spawnedMob.transform.parent = null; spawnedMob.GetComponent<Rigidbody>().isKinematic = false; spawnedMob.layer = 9; Humanoid component = spawnedMob.GetComponent<Humanoid>(); if ((Object)(object)component != (Object)null) { component.m_rightItem = CommonResources.DwarfGoblinSpearData; component.m_inventory.m_inventory[0] = CommonResources.DwarfGoblinSpearData; ((Character)component).m_turnSpeed = 300f; ((Character)component).m_runTurnSpeed = 100f; } } } } } public static class ML_Sword_Frigga { public static void init() { new Item("dybassets", "ML_Sword_Frigga_1").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_L_1").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_R_1").Configurable = Configurability.Disabled; ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_1"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_1"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_1"); new Item("dybassets", "ML_Sword_Frigga_2").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_L_2").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_R_2").Configurable = Configurability.Disabled; ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_2"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_2"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_2"); new Item("dybassets", "ML_Sword_Frigga_3_Cold").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_L_3_Cold").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_R_3_Cold").Configurable = Configurability.Disabled; ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_3_Cold"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_3_Cold"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_3_Cold"); new Item("dybassets", "ML_Sword_Frigga_3_Fire").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_L_3_Fire").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_R_3_Fire").Configurable = Configurability.Disabled; ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_3_Fire"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_3_Fire"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_3_Fire"); new Item("dybassets", "ML_Sword_Frigga_3_Light").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_L_3_Light").Configurable = Configurability.Disabled; new Item("dybassets", "ML_Sword_Spider_R_3_Light").Configurable = Configurability.Disabled; ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_3_Light"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_3_Light"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_3_Light"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_ml_spawn"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_ml_despawn"); } } public class OceanLocations { internal static void LocationsAwake() { //IL_002a: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) new Location("dybassets", "ML_ShipWreck02") { MapIcon = "bossicon.png", ShowMapIcon = ShowIcon.Never, SpawnArea = (BiomeArea)2, Biome = (Biome)256, SpawnDistance = new LocationManager.Range(50f, 10000f), SpawnAltitude = new LocationManager.Range(-1000f, -20f), MinimumDistanceFromGroup = 1000f, Count = 10, Unique = false }; new Location("dybassets", "ML_ShipWreck03") { MapIcon = "bossicon.png", ShowMapIcon = ShowIcon.Never, SpawnArea = (BiomeArea)2, Biome = (Biome)256, SpawnDistance = new LocationManager.Range(50f, 10000f), SpawnAltitude = new LocationManager.Range(-1000f, -20f), MinimumDistanceFromGroup = 1000f, Count = 10, Unique = false }; new Location("dybassets", "Balder_Altar") { Prioritize = true, MapIcon = "bossicon.png", ShowMapIcon = ShowIcon.Never, SpawnArea = (BiomeArea)2, Biome = (Biome)256, SpawnDistance = new LocationManager.Range(200f, 3000f), SpawnAltitude = new LocationManager.Range(-1000f, -25f), MinimumDistanceFromGroup = 1000f, Count = 1, Unique = false }; } } public class Locations { internal static void LocationsAwake() { //IL_0032: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) new Location("dybassets", "AshHuldraQueen_Altar") { Prioritize = true, MapIcon = "bossicon.png", ShowMapIcon = ShowIcon.Never, Biome = (Biome)32, SpawnArea = (BiomeArea)2, SpawnDistance = new LocationManager.Range(50f, 10000f), SpawnAltitude = new LocationManager.Range(5f, 1000f), MinimumDistanceFromGroup = 2000f, Count = 1, Unique = false }; new Location("dybassets", "AshlandsCave_01") { Prioritize = true, MapIcon = "bossicon.png", ShowMapIcon = ShowIcon.Never, Biome = (Biome)32, SpawnDistance = new LocationManager.Range(500f, 10000f), SpawnAltitude = new LocationManager.Range(20f, 1000f), MinimumDistanceFromGroup = 2000f, Count = 7, Unique = false }; new Location("dybassets", "AshlandsCave_02") { Prioritize = true, MapIcon = "bossicon.png", ShowMapIcon = ShowIcon.Never, Biome = (Biome)32, SpawnDistance = new LocationManager.Range(500f, 10000f), SpawnAltitude = new LocationManager.Range(20f, 1000f), MinimumDistanceFromGroup = 2000f, Count = 7, Unique = false }; new Location("dybassets", "SpiderCave01") { Prioritize = true, MapIcon = "bossicon.png", ShowMapIcon = ShowIcon.Never, Biome = (Biome)8, SpawnArea = (BiomeArea)3, SpawnDistance = new LocationManager.Range(500f, 1000f), SpawnAltitude = new LocationManager.Range(5f, 1000f), MinimumDistanceFromGroup = 3000f, Count = 1, Unique = false }; new Location("dybassets", "Mystical_Well0") { Prioritize = true, MapIcon = "ML_Hammer_Icon.png", ShowMapIcon = ShowIcon.Always, Biome = (Biome)1, SpawnDistance = new LocationManager.Range(100f, 500f), SpawnAltitude = new LocationManager.Range(10f, 1000f), MinimumDistanceFromGroup = 3000f, Count = 1, Unique = false }; } } [BepInPlugin("MonsterLabZ", "MonsterLabZ", "3.0.11")] public class MonsterLabZ : BaseUnityPlugin { [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class ZNetScene_Awake_PostPatch { public static void Prefix(ZNetScene __instance) { ShaderSwapper.GatherCustomShaders(__instance); } [HarmonyPriority(0)] public static void Postfix(ZNetScene __instance) { if (!((Object)(object)__instance == (Object)null) && !fixedReferences) { ShaderSwapper.ReplaceCustomShaders(); CommonResources.FindCommonResources(); fixedReferences = true; } } } public const string ModGUID = "MonsterLabZ"; public const string ModName = "MonsterLabZ"; public const string ModVersion = "3.0.11"; public static ManualLogSource Log; private readonly Harmony harmony = new Harmony("MonsterLabZ"); private static bool fixedReferences; public void Awake() { Localizer.Load(); Locations.LocationsAwake(); OceanLocations.LocationsAwake(); ML_DebugMonsters.init(); ML_NaturalDisasters.init(); NPC_Items.init(); Butterfly.init(); DeepSea_Serpent.init(); EvilShadow.init(); FireGolem.init(); NormalGhostWarrior.init(); DwarfGoblin.init(); GoblinShip.init(); DraugrShip.init(); IceGolem.init(); Kraken.init(); Molluscan.init(); NightmareDragon.init(); NormalSkeleton.init(); FireSkeleton.init(); IceSkeleton.init(); PoisonSkeleton.init(); Frigga.init(); Svartalfar.init(); Succubus.init(); Surtr.init(); WraithWarrior.init(); Spiders.init(); ObsidianGolem.init(); ML_Surtling.init(); NPC_Female.init(); NPC_Male.init(); Greydwarf.init(); ChaosSkeleton.init(); ML_CustomProps.init(); ML_Sword_Frigga.init(); ML_Mistile.init(); ML_Tentaroot.init(); ML_Hatchlings.init(); ML_JellyFish.init(); harmony.PatchAll(); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } public static class NormalGhostWarrior { public static void init() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) Creature creature = new Creature("dybassets", "NormalGhostWarrior") { Biome = (Biome)0 }; creature.ConfigurationEnabled = false; creature.Drops["Ruby"].Amount = new CreatureManager.Range(1f, 1f); creature.Drops["Ruby"].DropChance = 100f; creature.Drops["Ruby"].DropOnePerPlayer = false; creature.Drops["Ruby"].MultiplyDropByLevel = false; ItemManager.PrefabManager.RegisterPrefab("dybassets", "GhostWarrior"); new Item("dybassets", "ghost_poisonball").Configurable = Configurability.Disabled; ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_ghost_poison_explode"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_ghost_poison_start"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_ghostpoison_hit"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_ghost_poison_explosion"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "ghost_poisonball_projectile"); } } public static class DwarfGoblin { public static void init() { //IL_0018: 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_02a4: Unknown result type (might be due to invalid IL or missing references) Creature creature = new Creature("dybassets", "DwarfGoblin") { Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, RequiredAltitude = new CreatureManager.Range(1f, 1000f), CheckSpawnInterval = 300, SpawnChance = 25f, GroupSize = new CreatureManager.Range(4f, 5f), Maximum = 8, SpecificSpawnTime = SpawnTime.Always }; creature.Drops["Coins"].Amount = new CreatureManager.Range(3f, 5f); creature.Drops["Coins"].DropChance = 100f; creature.Drops["Coins"].DropOnePerPlayer = false; creature.Drops["Coins"].MultiplyDropByLevel = true; Creature creature2 = new Creature("dybassets", "DwarfGoblinLoot") { Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, RequiredAltitude = new CreatureManager.Range(1f, 1000f), CheckSpawnInterval = 300, SpawnChance = 5f, GroupSize = new CreatureManager.Range(1f, 1f), Maximum = 2, SpecificSpawnTime = SpawnTime.Day }; creature2.Drops["Coins"].Amount = new CreatureManager.Range(5f, 8f); creature2.Drops["Coins"].DropChance = 100f; creature2.Drops["Coins"].DropOnePerPlayer = false; creature2.Drops["Coins"].MultiplyDropByLevel = true; creature2.Drops["Amber"].Amount = new CreatureManager.Range(2f, 4f); creature2.Drops["Amber"].DropChance = 100f; creature2.Drops["Amber"].DropOnePerPlayer = false; creature2.Drops["Amber"].MultiplyDropByLevel = true; creature2.Drops["Ruby"].Amount = new CreatureManager.Range(1f, 3f); creature2.Drops["Ruby"].DropChance = 100f; creature2.Drops["Ruby"].DropOnePerPlayer = false; creature2.Drops["Ruby"].MultiplyDropByLevel = true; Creature creature3 = new Creature("dybassets", "DwarfGoblinShaman") { Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Everywhere, RequiredAltitude = new CreatureManager.Range(1f, 1000f), CheckSpawnInterval = 450, SpawnChance = 10f, GroupSize = new CreatureManager.Range(1f, 2f), Maximum = 2, SpecificSpawnTime = SpawnTime.Always }; creature3.Drops["Coins"].Amount = new CreatureManager.Range(4f, 6f); creature3.Drops["Coins"].DropChance = 100f; creature3.Drops["Coins"].DropOnePerPlayer = false; creature3.Drops["Coins"].MultiplyDropByLevel = true; ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblin_ragdoll"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblinLoot_ragdoll"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblinShaman_ragdoll"); new Item("dybassets", "DwarfGoblinBow").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinPickAxe").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinClub").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinSword").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinTorch").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinShieldBlackMetal").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinShieldWood").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinArmBandFeathers").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinArmBandIron").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinArmorBronze").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinArmorFeathers").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinArmorIron").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinArmorLeather").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinHelmetBronze").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinHelmetLeather").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinHelmetSkull").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinShamanStaffBones").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinShamanStaffFeathers").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinShoulderPadIron").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinShoulderPadLeather").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinSpear").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinSpearLox").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinSpearChitin").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinShamanBoat_attack_fireball").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinShaman_attack_fireball").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinShaman_attack_poke").Configurable = Configurability.Disabled; new Item("dybassets", "DwarfGoblinLoot_Run").Configurable = Configurability.Disabled; ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_alert"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_die"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_hit"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_idle"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_taunt"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblinSpear_projectile"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblinSpearChitin_projectile"); } } public static class GoblinLox { public static void init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) Creature creature = new Creature("dybassets", "ML_GoblinLox") { Biome = (Biome)16, SpecificSpawnArea = SpawnArea.Edge, RequiredAltitude = new CreatureManager.Range(1f, 1000f), CheckSpawnInterval = 1000, SpawnChance = 5f, GroupSize = new CreatureManager.Range(2f, 2f), Maximum = 2, SpecificSpawnTime = SpawnTime.Always }; creature.Drops["LoxMeat"].Amount = new CreatureManager.Range(4f, 6f); creature.Drops["LoxMeat"].DropChance = 100f; creature.Drops["LoxMeat"].DropOnePerPlayer = false; creature.Drops["LoxMeat"].MultiplyDropByLevel = true; creature.Drops["TrophyLox"].Amount = new CreatureManager.Range(1f, 1f); creature.Drops["TrophyLox"].DropChance = 10f; creature.Drops["TrophyLox"].DropOnePerPlayer = false; creature.Drops["TrophyLox"].MultiplyDropByLevel = true; creature.Drops["LoxPelt"].Amount = new CreatureManager.Range(2f, 3f); creature.Drops["LoxPelt"].DropChance = 100f; creature.Drops["LoxPelt"].DropOnePerPlayer = false; creature.Drops["LoxPelt"].MultiplyDropByLevel = true; Creature creature2 = new Creature("dybassets", "GoblinLoxRider") { Biome = (Biome)0 }; creature2.ConfigurationEnabled = false; creature2.Drops["Coins"].Amount = new CreatureManager.Range(3f, 5f); creature2.Drops["Coins"].DropChance = 100f; creature2.Drops["Coins"].DropOnePerPlayer = false; creature2.Drops["Coins"].MultiplyDropByLevel = true; ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_GoblinLox_Ragdoll"); } } public static class Kraken { public static void init() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) Creature creature = new Creature("dybassets", "KrakenLD") { Biome = (Biome)256, SpecificSpawnArea = SpawnArea.Center, RequiredAltitude = new CreatureManager.Range(-1000f, -5f), RequiredOceanDepth = new CreatureManager.Range(20f, 30f), CheckSpawnInterval = 600, RequiredGlobalKey = GlobalKey.KilledBonemass, RequiredWeather = Weather.ThunderStorm, SpawnChance = 2f, GroupSize = new CreatureManager.Range(1f, 1f), Maximum = 1, SpecificSpawnTime = SpawnTime.Always }; creature.Drops["KrakenMeat"].Amount = new CreatureManager.Range(10f, 15f); creature.Drops["KrakenMeat"].DropChance = 100f; creature.Drops["KrakenMeat"].DropOnePerPlayer = false; creature.Drops["KrakenMeat"].MultiplyDropByLevel = false; creature.Drops["Chitin"].Amount = new CreatureManager.Range(5f, 8f); creature.Drops["Chitin"].DropChance = 100f; creature.Drops["Chitin"].DropOnePerPlayer = false; creature.Drops["Chitin"].MultiplyDropByLevel = true; new Creature("dybassets", "Kraken_Blob") { Biome = (Biome)0, ConfigurationEnabled = false }; ItemManager.PrefabManager.RegisterPrefab("dybassets", "KrakenLD_ragdoll"); new Item("dybassets", "KrakenMeat").Configurable = Configurability.Disabled; new Item("dybassets", "kraken_attack1").Configurable = Configurability.Disabled; new Item("dybassets", "kraken_attack2").Configurable = Configurability.Disabled; new Item("dybassets", "kraken_attack3").Configurable = Configurability.Disabled; new Item("dybassets", "kraken_attack4").Configurable = Configurability.Disabled; new Item("dybassets", "kraken_attacklightning").Configurable = Configurability.Disabled; new Item("dybassets", "kraken_poisonball").Configurable = Configurability.Disabled; new Item("dybassets", "kraken_taunt").Configurable = Configurability.Disabled; new Item("dybassets", "krakenblob_attack").Configurable = Configurability.Disabled; ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_alert"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_attack"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_death"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_hit"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_idle"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_taunt"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_krakenpoison_launch"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_attack"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_attacklightning"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_hit"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_spit"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_watersurface"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_krakenpoison_hit"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_krakenpoison_hitground"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_watersplash_kraken"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_krakenblob_attack"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_lightning_hit"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "inkblob_projectile"); } } public static class Molluscan { public static void init() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) Creature creature = new Creature("dybassets", "Molluscan") { Biome = (Biome)256, SpecificSpawnArea = SpawnArea.Everywhere, RequiredAltitude = new CreatureManager.Range(-1000f, -10f), RequiredOceanDepth = new CreatureManager.Range(15f, 30f), CheckSpawnInterval = 450, SpawnChance = 15f, GroupSize = new CreatureManager.Range(1f, 2f), Maximum = 4, SpecificSpawnTime = SpawnTime.Always }; creature.Drops["TrophyDeepSeaMolluscan"].Amount = new CreatureManager.Range(1f, 1f); creature.Drops["TrophyDeepSeaMolluscan"].DropChance = 10f; creature.Drops["TrophyDeepSeaMolluscan"].DropOnePerPlayer = false; creature.Drops["TrophyDeepSeaMolluscan"].MultiplyDropByLevel = false; creature.Drops["Chitin"].Amount = new CreatureManager.Range(2f, 3f); creature.Drops["Chitin"].DropChance = 100f; creature.Drops["Chitin"].DropOnePerPlayer = false; creature.Drops["Chitin"].MultiplyDropByLevel = true; Creature creature2 = new Creature("dybassets", "MolluscanLand") { Biome = (Biome)8, SpecificSpawnArea = SpawnArea.Everywhere, RequiredOceanDepth = new CreatureManager.Range(1f, 2f), RequiredAltitude = new CreatureManager.Range(-1f, 10f), RequiredWeather = (Weather.LightRain | Weather.Rain | Weather.ThunderStorm), CheckSpawnInterval = 450, SpawnChance = 25f, GroupSize = new CreatureManager.Range(1f, 1f), Maximum = 2, SpecificSpawnTime = SpawnTime.Always }; creature2.Drops["TrophyMolluscan"].Amount = new CreatureManager.Range(1f, 1f); creature2.Drops["TrophyMolluscan"].DropChance = 10f; creature2.Drops["TrophyMolluscan"].DropOnePerPlayer = false; creature2.Drops["TrophyMolluscan"].MultiplyDropByLevel = false; creature2.Drops["Chitin"].Amount = new CreatureManager.Range(1f, 1f); creature2.Drops["Chitin"].DropChance = 100f; creature2.Drops["Chitin"].DropOnePerPlayer = false; creature2.Drops["Chitin"].MultiplyDropByLevel = true; ItemManager.PrefabManager.RegisterPrefab("dybassets", "Molluscan_ragdoll"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "DeepSeaMolluscan_ragdoll"); new Item("dybassets", "TrophyMolluscan").Configurable = Configurability.Disabled; new Item("dybassets", "TrophyDeepSeaMolluscan").Configurable = Configurability.Disabled; new Item("dybassets", "Molluscan_attack").Configurable = Configurability.Disabled; new Item("dybassets", "Molluscan_attack2").Configurable = Configurability.Disabled; new Item("dybassets", "Molluscan_attack3").Configurable = Configurability.Disabled; new Item("dybassets", "Molluscan_taunt").Configurable = Configurability.Disabled; new Item("dybassets", "MolluscanLand_attack").Configurable = Configurability.Disabled; new Item("dybassets", "MolluscanLand_attack2").Configurable = Configurability.Disabled; new Item("dybassets", "MolluscanLand_attack3").Configurable = Configurability.Disabled; new Item("dybassets", "MolluscanLand_taunt").Configurable = Configurability.Disabled; ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_alert"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_attack"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_death"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_hit"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_idle"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_taunt"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_alert"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_attack"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_death"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_hit"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_idle"); ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_taunt"); } } public static class FireSkeleton { public static void init() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) Creature creature = new Creature("dybassets", "FireSkeletonWarrior") { Biome = (Biome)0 }; creature.ConfigurationEnabled = true; creature.Drops["TrophySkeletonFire"].Amount = new CreatureManager.Range(1f, 1f); creature.Drops["TrophySkeletonFire"].DropChance = 10f; creature.Drops["TrophySkeletonFire"].DropOnePerPlayer = false; creature.Drops["TrophySkeletonFire"].MultiplyDropByLevel = false; creature.Drops["BoneFragments"].Amount = new CreatureManager.Range(1f, 1f); creature.Drops["BoneFragments"].DropChance = 100f; creature.Drops["BoneFragments"].DropOnePerPlayer = false; creature.Drops["BoneFragments"].MultiplyDropByLevel = true; Creature creature2 = new Creature("dybassets", "FireSkeletonWarriorNoFx") { Biome = (Biome)0 }; creature2.ConfigurationEnabled = true; creature2.Drops["TrophySkeletonFire"].Amount = new CreatureManager.Range(1f, 1f); creature2.Drops["TrophySkeletonFire"].DropChance = 10f; creature2.Drops["TrophySkeletonFire"].DropOnePerPlayer = false; creature2.Drops["TrophySkeletonFire"].MultiplyDropByLevel = false; creature2.Drops["BoneFragmen