Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SlingShot v1.1.1
GsiX.SlingShot.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("JotunnModStub")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JotunnModStub")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] namespace SlingShot; internal class SlingJump { private GameObject Anim_Jump1; private GameObject Anim_Jump2; private GameObject Anim_Jump3; private GameObject Anim_Jump4; private Quaternion rotbuff; private readonly float rotX = 90f; private readonly float rotY; private readonly float rotZ; public void LoadAnim() { Anim_Jump1 = ZNetScene.instance.GetPrefab("fx_iceshard_launch"); Anim_Jump2 = ZNetScene.instance.GetPrefab("fx_float_nibble"); Anim_Jump3 = ZNetScene.instance.GetPrefab("fx_fenring_flames"); Anim_Jump4 = ZNetScene.instance.GetPrefab("fx_Abomination_attack1"); } public void CreateEffect(Vector3 pos, Quaternion rot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) rotbuff = rot; rotbuff *= Quaternion.Euler(rotX, rotY, rotZ); Play(Anim_Jump1, pos, rotbuff); Play(Anim_Jump2, pos, rotbuff); static void Play(GameObject fxAnime, Vector3 fxPos, Quaternion fxRot) { //IL_000a: 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) if ((Object)(object)fxAnime != (Object)null) { Object.Instantiate<GameObject>(fxAnime, fxPos, fxRot); } } } } [BepInPlugin("GsiX.SlingShot", "GsiX Sling Shot", "1.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class SlingShotPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "Start")] private static class Player_Start_Patch { private static void Postfix(Player __instance) { if (PluginEnabled.Value && !((Object)(object)__instance == (Object)null) && IsLocalPlayer(((Component)__instance).gameObject)) { if ((Object)(object)LocalPlayer == (Object)null) { LocalPlayer = __instance; } if ((Object)(object)LocalCharac == (Object)null) { LocalCharac = ((Component)__instance).GetComponent<Character>(); } if ((Object)(object)LocalHumans == (Object)null) { LocalHumans = ((Component)__instance).GetComponent<Humanoid>(); } Hammers.ResetHomming(isrespawn: true); } } } [HarmonyPatch(typeof(Player), "OnJump")] private static class Player_OnJump_Patch { private static void Postfix(Player __instance) { if (PluginEnabled.Value && !((Object)(object)__instance == (Object)null) && IsLocalPlayer(((Component)__instance).gameObject)) { AirJumpCount = 1; } } } [HarmonyPatch(typeof(Character), "UpdateGroundContact")] private static class Character_UpdateGroundContact_Patch { private static void Postfix(Character __instance, float dt) { if (PluginEnabled.Value && !((Object)(object)__instance == (Object)null) && IsLocalPlayer(((Component)__instance).gameObject) && __instance.IsOnGround()) { AirJumpCount = 0; SlingJumpCount = 0; AirJumpOverride = false; if ((Object)(object)Hammers.homming_characterDamage != (Object)null) { Hammers.HommingCharacterDamageDelayStart(); } } } } [HarmonyPatch(typeof(Character), "Damage")] private static class Character_Damage_Patch { private static bool Prefix(Character __instance, HitData hit, ref bool __runOriginal) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || !IsLocalPlayer(((Component)__instance).gameObject)) { return true; } if ((Object)(object)Hammers.homming_characterDamage == (Object)(object)__instance && (int)hit.m_hitType == 3) { __runOriginal = false; return false; } __runOriginal = true; return true; } } [HarmonyPatch(typeof(VisEquipment), "UpdateEquipmentVisuals")] private class VisEquipment_UpdateEquipmentVisuals_Patch { private static void Postfix(VisEquipment __instance) { //IL_0050: 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_00c2: Unknown result type (might be due to invalid IL or missing references) if (PluginEnabled.Value && (Object)(object)__instance != (Object)null) { if ((Object)(object)__instance.m_rightItemInstance != (Object)null && __instance.m_rightItem == Hammers.name) { __instance.m_rightItemInstance.transform.localScale = Hammers.GetScale(); } if ((Object)(object)__instance.m_rightBackItemInstance != (Object)null && __instance.m_rightBackItem == Hammers.name) { float num = Hammers.scale / 100f; __instance.m_rightBackItemInstance.transform.localScale = new Vector3(num, num, num); __instance.m_rightBackItemInstance.transform.localPosition = new Vector3(0f, 0f, 0.002f); } } } } [HarmonyPatch(typeof(ItemStand), "SetVisualItem")] private class ItemStand_SetVisualItem_Patch { private static void Postfix(ItemStand __instance, string itemName, int variant, int quality) { //IL_0045: 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) if (PluginEnabled.Value && (Object)(object)__instance != (Object)null && (Object)(object)__instance.m_visualItem != (Object)null && itemName == Hammers.name) { __instance.m_visualItem.transform.localScale = Hammers.GetScale(); __instance.m_visualItem.transform.localPosition = new Vector3(0f, 0.03f, -0.4f); } } } [HarmonyPatch(typeof(Humanoid), "StartAttack")] private static class Humanoid_StartAttack_Patch { private static bool Prefix(Humanoid __instance, Character target, bool secondaryAttack, ref bool __runOriginal, ref bool __result) { if (PluginEnabled.Value && (Object)(object)__instance != (Object)null && IsLocalPlayer(((Component)__instance).gameObject)) { if (!Hammers.IsHommingCompleted()) { __result = false; __runOriginal = false; return __runOriginal; } if (secondaryAttack) { ItemData currentWeapon = __instance.GetCurrentWeapon(); if (currentWeapon != null && Hammers.IsSlingPrefab(currentWeapon.m_dropPrefab) && ((RequiredJump.Value && AirJumpCount < 2 && !ZInput.GetKey((KeyCode)324, true)) || SlingJumpCount >= SlingJumpMaximum.Value)) { __result = false; __runOriginal = false; return __runOriginal; } } } __runOriginal = true; return __runOriginal; } private static void Postfix(Humanoid __instance, Character target, bool secondaryAttack, bool __result) { if (!PluginEnabled.Value || !((Object)(object)__instance != (Object)null) || !IsLocalPlayer(((Component)__instance).gameObject) || !secondaryAttack || !Hammers.IsHommingCompleted()) { return; } ItemData currentWeapon = __instance.GetCurrentWeapon(); if (currentWeapon != null && Hammers.IsSlingPrefab(currentWeapon.m_dropPrefab) && __result) { Hammers.HommingStart(__instance, currentWeapon); SlingJumpCount++; if (SlingJumpCount >= 3 && SlingJumpCount < SlingJumpMaximum.Value) { PrintCenterMsg("Sling Jump Count <color=green>" + SlingJumpCount + "</color>"); } else if (SlingJumpCount == SlingJumpMaximum.Value) { PrintCenterMsg("Sling Jump Count <color=green>Maximum</color>"); } } } } [HarmonyPatch(typeof(Humanoid), "IsBlocking")] private static class Humanoid_IsBlocking_Patch { private static bool Prefix(Humanoid __instance, ref bool __result, ref bool __runOriginal) { //IL_0044: 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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (!PluginEnabled.Value && (Object)(object)__instance == (Object)null) { __runOriginal = true; return __runOriginal; } if (IsLocalPlayer(((Component)__instance).gameObject)) { ItemData currentWeapon = __instance.GetCurrentWeapon(); if (Hammers.IsSlingPrefab(currentWeapon.m_dropPrefab)) { Gizmos.color = Color.blue; Gizmos.DrawWireCube(((Component)__instance).transform.position + Vector3.down * 3f, new Vector3(1f, 0.05f, 1f)); if (ZInput.GetKey((KeyCode)116, true) && Time.time - FarmModeInterval > 0.2f) { FarmModeInterval = Time.time; Hammers.SetFarmtype(); } } if (Hammers.homming_timeOut != -1f) { __result = false; __runOriginal = false; return __runOriginal; } } __runOriginal = true; return __runOriginal; } } [HarmonyPatch(typeof(Projectile), "Setup")] private static class Projectile_Setup_Patch { private static void Postfix(Projectile __instance, Character owner, Vector3 velocity, float hitNoise, HitData hitData, ItemData item, ItemData ammo) { if (PluginEnabled.Value && (Object)(object)__instance != (Object)null && (Object)(object)owner != (Object)null && IsLocalPlayer(((Component)owner).gameObject) && item != null && Hammers.IsSlingPrefab(item.m_dropPrefab)) { Hammers.ProjectileSetup(__instance, item, AreaAttackRadius.Value); } } } [HarmonyPatch(typeof(Projectile), "FixedUpdate")] private static class Projectile_FixedUpdate_Patch { private static bool Prefix(Projectile __instance, ref bool __runOriginal) { //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_004b: 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) if (PluginEnabled.Value && IsSlingShotProjectile(__instance) && IsLocalPlayer(((Component)__instance.m_owner).gameObject)) { Vector3 position = ((Component)__instance).transform.position; float value = SlingShotRange.Value; bool flag = Hammers.DidHitWater(position); bool key = ZInput.GetKey((KeyCode)32, true); if (key) { value = SlingJumpRange.Value; } if (Hammers.IsOutbound(__instance, value) || flag || Hammers.IsTimedOut()) { if (key) { __instance.m_owner.m_seman.AddStatusEffect(SlingJumpSE.NameHash(), true, 0, 0f); } Hammers.SetFakeHit(); __instance.OnHit((Collider)null, position, false); __runOriginal = false; return __runOriginal; } } __runOriginal = true; return __runOriginal; } } [HarmonyPatch(typeof(Projectile), "OnHit")] private static class Projectile_OnHit_Patch { private static void Postfix(Projectile __instance, Collider collider, Vector3 hitPoint, bool water) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (PluginEnabled.Value && IsSlingShotProjectile(__instance) && Hammers.homming_timeOut != -1f) { bool teleport = false; bool createStartEffect = false; if (!Hammers.isFarming && ((!Hammers.DidHitWater(hitPoint) && !Hammers.IsFakeHit()) || (__instance.m_owner.m_seman.HaveStatusEffect(SlingJumpSEname) && !Hammers.DidHitWater(hitPoint)))) { teleport = true; createStartEffect = EnableTakeoff.Value; } Vector3 position = ((Component)__instance.m_owner).transform.position; Hammers.HommingEnds(__instance, position, hitPoint, Quaternion.identity, teleport, createStartEffect, EnableLanding.Value); AirJumpOverride = true; } } } [HarmonyPatch(typeof(Projectile), "SpawnOnHit")] private static class Projectile_SpawnOnHit_Patch { private static bool Prefix(Projectile __instance, GameObject go, Collider collider, ref bool __runOriginal) { if (PluginEnabled.Value && IsSlingShotProjectile(__instance)) { __runOriginal = false; return __runOriginal; } __runOriginal = true; return __runOriginal; } } [HarmonyPatch(typeof(TombStone), "Awake")] private static class TombStone_Awake_Patch { private static void Postfix(TombStone __instance) { //IL_00a4: 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) if (!PluginEnabled.Value || !((Object)(object)__instance != (Object)null) || !Hammers.HasHommingDummy()) { return; } long owner = __instance.GetOwner(); long playerID = Player.m_localPlayer.GetPlayerID(); if (owner != playerID) { return; } Container component = ((Component)__instance).GetComponent<Container>(); Inventory val = ((component != null) ? component.GetInventory() : null); if (val != null) { if (val.HaveEmptySlot()) { val.AddItem(Hammers.GetHommingDummy()); DLog("SlingJump returned to " + Player.m_localPlayer.GetPlayerName() + "'s Tombstone inventory."); } else { ItemDrop.DropItem(Hammers.GetHommingDummy(), 0, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation); DLog("SlingJump spawned next to " + Player.m_localPlayer.GetPlayerName() + "'s Tombstone."); } Hammers.ResetHomming(isrespawn: true); } } } [HarmonyPatch(typeof(ZSyncTransform), "OwnerSync")] private class ZSyncTransform_OwnerSync_Patch { private static void Postfix(ref ZSyncTransform __instance) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (PluginEnabled.Value && IsSlingshotView(__instance.m_nview)) { __instance.m_nview.m_syncInitialScale = false; __instance.m_nview.SetLocalScale(new Vector3(Hammers.scale, Hammers.scale, Hammers.scale)); } } } [HarmonyPatch(typeof(ZSyncTransform), "ClientSync")] private class ZSyncTransform_ClientSync_Patch { private static void Postfix(ZSyncTransform __instance) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (PluginEnabled.Value && IsSlingshotView(__instance.m_nview)) { __instance.m_nview.m_syncInitialScale = false; __instance.m_nview.SetLocalScale(new Vector3(Hammers.scale, Hammers.scale, Hammers.scale)); } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class ZNetScene_Awake_Patch { private static void Postfix(ZNetScene __instance) { if ((Object)(object)__instance != (Object)null) { Hammers.LoadAnim(); DoJumps.LoadAnim(); } } } public const string PluginGUID = "GsiX.SlingShot"; public const string PluginName = "GsiX Sling Shot"; public const string PluginVersion = "1.1.1"; public const string PluginNamespace = "SlingShot"; private readonly Harmony harmony = new Harmony("GsiX.SlingShot"); private static ManualLogSource DeLogger; private static Player LocalPlayer; private static Character LocalCharac; private static Humanoid LocalHumans; private static StatusEffect SlingJumpSE; private static string SlingJumpSEname = "SlingJumpDescend"; private static int AirJumpCount; private static int SlingJumpCount; private static bool AirJumpOverride; private static float FarmModeInterval = Time.time; public static readonly string[] WorkbenchPiece = new string[6] { "piece_workbench", "forge", "piece_stonecutter", "piece_artisanstation", "blackforge", "piece_magetable" }; public static readonly string[] WorkbenchConfig = new string[6] { "workbench", "forge", "stonecutter", "artisanstation", "blackforge", "magetable" }; private static ConfigEntry<bool> PluginEnabled; private static ConfigEntry<bool> EnableMessage; private static ConfigEntry<float> JumpHealthCost; private static ConfigEntry<int> MaximumDoubleJump; private static ConfigEntry<bool> EnableSlingJump; private static ConfigEntry<bool> JumpRequireHammer; private static ConfigEntry<string> SlingCraftStations; private static ConfigEntry<string> SlingShotRequirement1; private static ConfigEntry<string> SlingShotRequirement2; private static ConfigEntry<string> SlingShotRequirement3; private static ConfigEntry<string> SlingShotRequirement4; private static ConfigEntry<float> SlingShotRange; private static ConfigEntry<float> SlingJumpRange; private static ConfigEntry<int> SlingJumpMaximum; private static ConfigEntry<bool> EnableTakeoff; private static ConfigEntry<bool> EnableLanding; private static ConfigEntry<bool> RequiredJump; private static ConfigEntry<float> AreaAttackRadius; private static readonly Dictionary<string, Texture2D> cachedTextures = new Dictionary<string, Texture2D>(); private static SlingHammer Hammers; private static SlingJump DoJumps; public void Awake() { DeLogger = ((BaseUnityPlugin)this).Logger; Hammers = new SlingHammer(); DoJumps = new SlingJump(); PluginEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("PluginEnable", "PluginEnabled", true, "Enable/disable plugin."); EnableMessage = ((BaseUnityPlugin)this).Config.Bind<bool>("SLINGJUMP SETUP", "EnableMessage", true, "Enable/Disable center message from SlingShot."); JumpHealthCost = ((BaseUnityPlugin)this).Config.Bind<float>("SLINGJUMP SETUP", "HealthCost", 2f, "Health cost every time double jump prefomed. Set 0 to turn off."); MaximumDoubleJump = ((BaseUnityPlugin)this).Config.Bind<int>("SLINGJUMP SETUP", "MaxAirJump", 2, "How many midair jump allowed."); EnableSlingJump = ((BaseUnityPlugin)this).Config.Bind<bool>("SLINGJUMP SETUP", "EnableSlingJump", true, "Enable/Disable multiple midair jump."); JumpRequireHammer = ((BaseUnityPlugin)this).Config.Bind<bool>("SLINGJUMP SETUP", "JumpRequireHammer", true, "Require Sling Hammer to do multiple jump."); SlingCraftStations = ((BaseUnityPlugin)this).Config.Bind<string>("REQUIREMENT", "CraftingStation", "forge", "Valid list - workbench, forge, stonecutter, artisanstation, blackforge, magetable"); SlingShotRequirement1 = ((BaseUnityPlugin)this).Config.Bind<string>("REQUIREMENT", "Requirement1", "Silver|20", "Crafting requirement. Can be empty for none"); SlingShotRequirement2 = ((BaseUnityPlugin)this).Config.Bind<string>("REQUIREMENT", "Requirement2", "Crystal|10", "Crafting requirement. Can be empty for none"); SlingShotRequirement3 = ((BaseUnityPlugin)this).Config.Bind<string>("REQUIREMENT", "Requirement3", "Thunderstone|1", "Crafting requirement. Can be empty for none"); SlingShotRequirement4 = ((BaseUnityPlugin)this).Config.Bind<string>("REQUIREMENT", "Requirement4", "BattleaxeCrystal|1", "Crafting requirement. Can be empty for none"); SlingShotRange = ((BaseUnityPlugin)this).Config.Bind<float>("SLINGSHOT SETUP", "SlingShotRange", 60f, "Maximum range Sling Shot didn't hit anything, return to owner. Min 5, Max 100 or timed out at 3 seconds"); SlingJumpRange = ((BaseUnityPlugin)this).Config.Bind<float>("SLINGSHOT SETUP", "SlingJumpRange", 30f, "Maximum range Sling Jump to teleport player. Min 5, Max 50"); SlingJumpMaximum = ((BaseUnityPlugin)this).Config.Bind<int>("SLINGSHOT SETUP", "SlingJumpMaximum", 10, "Maximum mid air sling jump(Holding Spacebar). Min 2, Max 15"); EnableTakeoff = ((BaseUnityPlugin)this).Config.Bind<bool>("SLINGSHOT SETUP", "EnableTakeoffAnimation", true, "Leave an animation, mark the former location."); EnableLanding = ((BaseUnityPlugin)this).Config.Bind<bool>("SLINGSHOT SETUP", "EnableLandingAnimation", true, "Leave an animation, mark the later location."); RequiredJump = ((BaseUnityPlugin)this).Config.Bind<bool>("SLINGSHOT SETUP", "RequiredJump", true, "Require at least double jump to do slingshot. EnableSlingJump must set to true."); AreaAttackRadius = ((BaseUnityPlugin)this).Config.Bind<float>("SLINGSHOT SETUP", "AreaAttackRadius", 3f, "Area of Demolish/Fetch radius."); SlingShotRange.SettingChanged += delegate { UpdateSlingSetup(); }; SlingJumpRange.SettingChanged += delegate { UpdateSlingSetup(); }; SlingJumpMaximum.SettingChanged += delegate { UpdateSlingSetup(); }; harmony.PatchAll(); AddLocalizations(); SlingJumpStatusEffects(); PrefabManager.OnVanillaPrefabsAvailable += SetupSlingShot; } private static void UpdateSlingSetup() { if (SlingShotRange.Value > 100f) { SlingShotRange.Value = 100f; } else if (SlingShotRange.Value < 5f) { SlingShotRange.Value = 5f; } if (SlingJumpRange.Value > 50f) { SlingJumpRange.Value = 50f; } else if (SlingShotRange.Value < 5f) { SlingShotRange.Value = 5f; } if (SlingJumpMaximum.Value > 15) { SlingJumpMaximum.Value = 15; } else if (SlingJumpMaximum.Value < 2) { SlingJumpMaximum.Value = 2; } } public void OnDestroy() { harmony.UnpatchSelf(); } public void Update() { if (PluginEnabled.Value && !((Object)(object)LocalPlayer == (Object)null) && !((Object)(object)LocalCharac == (Object)null) && !((Object)(object)LocalHumans == (Object)null)) { if (ZInput.GetKeyDown((KeyCode)32, true)) { DoDoubleJump(LocalCharac); } Hammers.DelayedSlingActionUpdate(); Hammers.AnimationSpeed(); Hammers.HommingEndRetry(); Hammers.HommingIntervalUpdate(); Hammers.HommingCharacterDamageDelayUpdate(); } } public void AddLocalizations() { CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); string text = "English"; localization.AddTranslation(ref text, new Dictionary<string, string> { { Hammers.item.Replace("$", ""), "Sling Shot" }, { "item_slingshot_desc", "\n<color=yellow>Midair Slingshot Ability</color>" }, { "slingeffect_fffectname", "Sling Jump" } }); } private void SlingJumpStatusEffects() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown SE_Stats obj = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)obj).name = SlingJumpSEname; ((StatusEffect)obj).m_name = "$slingeffect_fffectname"; obj.m_maxMaxFallSpeed = 0.1f; CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)obj, false); SlingJumpSE = val.StatusEffect; SlingJumpSE.m_ttl = 1f; ItemManager.Instance.AddStatusEffect(val); } public void SetupSlingShot() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown string text = SlingCraftStations.Value.Replace(" ", ""); string craftingStation = WorkbenchPiece[0]; for (int i = 0; i < WorkbenchConfig.Length; i++) { if (WorkbenchConfig[i] == text) { craftingStation = WorkbenchPiece[i]; break; } } LoadTexture("SlingShot", "slingshot_texture.png"); Texture2D val = LoadTexture("SlingShot", "slingshot_icon.png"); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero); ItemConfig val3 = new ItemConfig(); val3.Name = Hammers.item; val3.Description = "$item_slingshot_desc"; val3.CraftingStation = craftingStation; val3.RepairStation = null; val3.Amount = 1; val3.Icons = (Sprite[])(object)new Sprite[1] { val2 }; ItemConfig val4 = val3; AddRequirement(val4, SlingShotRequirement1.Value); AddRequirement(val4, SlingShotRequirement2.Value); AddRequirement(val4, SlingShotRequirement3.Value); AddRequirement(val4, SlingShotRequirement4.Value); CustomItem val5 = new CustomItem(Hammers.name, Hammers.clone, val4); ItemManager.Instance.AddItem(val5); PrefabManager.OnVanillaPrefabsAvailable -= SetupSlingShot; static void AddRequirement(ItemConfig itemconfig, string requirement) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown string text2 = requirement.Replace(" ", ""); text2 = text2.Replace(" ", ""); if (text2.Length > 3) { string[] array = text2.Split(new char[1] { '|' }); if (array.Length == 2) { if (int.TryParse(array[1].Replace(" ", ""), out var result) && itemconfig != null) { itemconfig.AddRequirement(new RequirementConfig(array[0], result, 0, false)); } } else { Logger.LogWarning((object)"********** AddRequirement Vertical Pipe/Splitter Error **********"); } } } } public static void DoDoubleJump(Character character) { //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_018e: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0287: 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_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) if (!EnableSlingJump.Value || AirJumpCount <= 0 || (AirJumpCount > MaximumDoubleJump.Value && !AirJumpOverride)) { return; } if (JumpRequireHammer.Value) { Humanoid component = ((Component)character).GetComponent<Humanoid>(); if ((Object)(object)component != (Object)null && (component.m_rightItem == null || !component.m_rightItem.IsWeapon() || !Hammers.IsSlingPrefab(component.m_rightItem.m_dropPrefab))) { return; } } if (JumpHealthCost.Value > 0f && character.GetHealth() - JumpHealthCost.Value <= JumpHealthCost.Value) { Hud.instance.FlashHealthBar(); PrintCenterMsg("Health Too Low"); return; } bool flag = false; if (!character.HaveStamina(character.m_jumpStaminaUsage)) { if (character.IsPlayer()) { Hud.instance.StaminaBarEmptyFlash(); } flag = true; } float speed = character.m_speed; character.m_seman.ApplyStatusEffectSpeedMods(ref speed); if (speed <= 0f) { flag = true; } float num = 0f; Skills skills = character.GetSkills(); if ((Object)(object)skills != (Object)null) { num = skills.GetSkillFactor((SkillType)100); if (!flag) { character.RaiseSkill((SkillType)100, 1f); } float num2 = 2f; if (AirJumpCount >= 2) { num2 = 4f; } num *= num2; } Vector3 val = character.m_body.velocity; Mathf.Acos(Mathf.Clamp01(character.m_lastGroundNormal.y)); Vector3 val2 = character.m_lastGroundNormal + Vector3.up; Vector3 normalized = ((Vector3)(ref val2)).normalized; float num3 = 1f + num * 0.4f; float num4 = character.m_jumpForce * num3; float num5 = Vector3.Dot(normalized, val); if (num5 < num4) { val += normalized * (num4 - num5); } val += character.m_moveDir * character.m_jumpForceForward * num3; if (flag) { val *= character.m_jumpForceTiredFactor; } character.m_seman.ApplyStatusEffectJumpMods(ref val); if (val.x > 0f || val.y > 0f || val.z > 0f) { Hammers.homming_characterDamage = character; character.m_body.velocity = val; character.m_jumpTimer = 0f; character.m_zanim.SetTrigger("jump"); character.AddNoise(30f); character.m_jumpEffects.Create(((Component)character).transform.position, ((Component)character).transform.rotation, ((Component)character).transform, 1f, -1); if (JumpHealthCost.Value > 0f) { Vector3 lastGroundPoint = character.m_lastGroundPoint; lastGroundPoint.y += 3f; HitData val3 = new HitData(); val3.m_damage.m_damage = JumpHealthCost.Value; val3.m_point = lastGroundPoint; val3.m_dir = character.m_lastGroundNormal; val3.m_hitType = (HitType)14; character.Damage(val3); } DoJumps.CreateEffect(((Component)character).transform.position, ((Component)character).transform.rotation); AirJumpCount++; AirJumpOverride = false; } } private static bool IsLocalPlayer(GameObject instance) { if ((Object)(object)instance != (Object)null) { Player component = instance.GetComponent<Player>(); if ((Object)(object)component != (Object)null) { return (Object)(object)component == (Object)(object)Player.m_localPlayer; } return false; } return false; } private static bool IsSlingShotProjectile(Projectile projectile) { if ((Object)(object)projectile != (Object)null && projectile.m_spawnItem != null && (Object)(object)projectile.m_owner != (Object)null) { return ((Object)projectile.m_spawnItem.m_dropPrefab).name == Hammers.name; } return false; } private static Texture2D LoadTexture(string pluginGUID, string fileName) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0059: Expected O, but got Unknown Texture2D val; if (cachedTextures.ContainsKey(fileName)) { val = cachedTextures[fileName]; } else { Stream? manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(pluginGUID + ".Package.Assets." + fileName); byte[] array = new byte[manifestResourceStream.Length]; manifestResourceStream.Read(array, 0, array.Length); Texture2D val2 = new Texture2D(0, 0); ImageConversion.LoadImage(val2, array); val = val2; cachedTextures.Add(fileName, val); } return val; } private static bool IsSlingshotView(ZNetView instance) { if ((Object)(object)instance != (Object)null) { return instance.GetPrefabName() == Hammers.name; } return false; } private static void PrintCenterMsg(string text) { if (EnableMessage.Value && (Object)(object)LocalHumans != (Object)null) { ((Character)LocalHumans).Message((MessageType)2, Localization.instance.Localize(text), 0, (Sprite)null); } } private static void DLog(string text) { DeLogger.LogMessage((object)text); } } internal class SlingHammer { private enum FarmType { Demolish, Repair, ItemFetch, FriendlyFetch, TameableFetch, EnemyFetch } public readonly string name = "SlingShot"; public readonly string item = "$item_slingshot"; public readonly string clone = "BattleaxeCrystal"; private readonly string anime_throw = "SpearCarapace"; private readonly string anime_dummy = "DvergerStaffIce_projectile"; private readonly string sprite_start = "vfx_Potion_health_medium"; private readonly string sprite_ends = "fx_Potion_frostresist"; public float scale = 0.5f; private const float scale2 = 1f; private readonly float speedVels = 60f; private readonly float speedAnim = 3f; public bool isFarming; public bool isFakeHit; private Vector3 projectileScale = new Vector3(1f, 1f, 1f); private GameObject Hammer_Instance; private GameObject Hammer_Dummy; private GameObject Animat_Throw; private GameObject Sprite_Start; private GameObject Sprite_Ends; private Humanoid localHuman; private List<GameObject> Sprite_Hits = new List<GameObject>(); private readonly string[] sprite_hits = new string[3] { "fx_shaman_fireball_expl", "fx_guardstone_permitted_add", "fx_himminafl_aoe" }; private FarmType farmingType; private readonly string[] farmText = new string[6] { "Sling Demolish", "Sling Repair", "Sling Items Fetch", "Sling Friendly Fetch", "Sling Tameable Fetch", "Sling Enemy Fetch" }; private readonly float DelayedPickup = 1f; private float DelayedItemDrop_Time = -1f; private float DelayedCharacter_Time = -1f; private float DelayedRepair_Time = -1f; private List<KeyValuePair<ItemDrop, Humanoid>> DelayedItemDrop = new List<KeyValuePair<ItemDrop, Humanoid>>(); private List<KeyValuePair<Character, Character>> DelayedCharacter = new List<KeyValuePair<Character, Character>>(); private List<KeyValuePair<WearNTear, Piece>> DelayedRepair = new List<KeyValuePair<WearNTear, Piece>>(); private int ChracterkMask = LayerMask.GetMask(new string[5] { "character", "character_net", "character_ghost", "hitbox", "character_noenv" }); private ZSyncAnimation homming_animE; private Humanoid homming_owneR; private ItemData homming_dummY; public Character homming_characterDamage; private Inventory homming_inventorY; private float homming_characterDelay = -1f; public float homming_timeOut = -1f; public float homming_equipDelay = -1f; private float homming_interval = -1f; private int homming_retry; public void LoadAnim() { //IL_00d7: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < sprite_hits.Length; i++) { GameObject prefab = ZNetScene.instance.GetPrefab(sprite_hits[i]); if ((Object)(object)prefab != (Object)null) { Sprite_Hits.Add(prefab); } } Animat_Throw = ZNetScene.instance.GetPrefab(anime_throw); Sprite_Start = ZNetScene.instance.GetPrefab(sprite_start); Sprite_Ends = ZNetScene.instance.GetPrefab(sprite_ends); Hammer_Dummy = ZNetScene.instance.GetPrefab(anime_dummy); Hammer_Instance = ZNetScene.instance.GetPrefab(name); if (!((Object)(object)Hammer_Instance != (Object)null)) { return; } Hammer_Instance.transform.localScale = new Vector3(scale, scale, scale); ItemDrop val = default(ItemDrop); if (Hammer_Instance.TryGetComponent<ItemDrop>(ref val)) { val.m_itemData.m_shared.m_animationState = (AnimationState)1; val.m_itemData.m_shared.m_itemType = (ItemType)3; val.m_itemData.m_shared.m_attachOverride = (ItemType)3; val.m_itemData.m_shared.m_weight = 1f; val.m_itemData.m_shared.m_equipDuration = 0f; val.m_itemData.m_shared.m_backstabBonus = 8f; val.m_itemData.m_shared.m_deflectionForce = 30f; val.m_itemData.m_shared.m_deflectionForcePerLevel = 20f; val.m_itemData.m_shared.m_blockPower = 20f; val.m_itemData.m_shared.m_blockPowerPerLevel = 10f; val.m_itemData.m_shared.m_attackForce = 10f; val.m_itemData.m_shared.m_movementModifier = 0f; val.m_itemData.m_shared.m_spawnOnHit = null; val.m_itemData.m_shared.m_spawnOnHitTerrain = null; val.m_itemData.m_shared.m_damages.m_damage = 40f; val.m_itemData.m_shared.m_damages.m_blunt = 1f; val.m_itemData.m_shared.m_damages.m_frost = 1f; val.m_itemData.m_shared.m_damages.m_slash = 12f; val.m_itemData.m_shared.m_damages.m_pierce = 12f; val.m_itemData.m_shared.m_damages.m_chop = 8f; val.m_itemData.m_shared.m_damages.m_pickaxe = 8f; val.m_itemData.m_shared.m_damages.m_lightning = 1f; val.m_itemData.m_shared.m_damages.m_fire = 1f; val.m_itemData.m_shared.m_damages.m_poison = 1f; val.m_itemData.m_shared.m_damages.m_spirit = 1f; val.m_itemData.m_shared.m_attack.m_drawDurationMin = 0f; val.m_itemData.m_shared.m_attack.m_attackStamina = 12f; val.m_itemData.m_shared.m_attack.m_attackAnimation = "swing_longsword"; ItemDrop val2 = default(ItemDrop); if ((Object)(object)Animat_Throw != (Object)null && Animat_Throw.TryGetComponent<ItemDrop>(ref val2)) { Attack val3 = val2.m_itemData.m_shared.m_secondaryAttack.Clone(); val3.m_speedFactor = 0.1f; val3.m_projectileBursts = 1; val3.m_ammoItem = null; val3.m_attackProjectile = Hammer_Dummy; val3.m_projectileVel = speedVels; val3.m_projectileVelMin = speedVels; val3.m_projectileAccuracy = 1f; val3.m_projectileAccuracyMin = 1f; val3.m_attackHeight = 1.6f; val3.m_attackRange = 1.9f; val3.m_drawDurationMin = 0f; val3.m_attackStamina = 0f; val3.m_drawStaminaDrain = 0f; val3.m_damageMultiplier = 0f; val3.m_forceMultiplier = 0f; CollectionExtensions.AddItem<EffectData>((IEnumerable<EffectData>)val3.m_hitEffect.m_effectPrefabs, CreateEffect(Sprite_Ends)); val.m_itemData.m_shared.m_secondaryAttack = val3; } } ZSyncTransform val4 = default(ZSyncTransform); if (Hammer_Instance.TryGetComponent<ZSyncTransform>(ref val4)) { val4.m_syncPosition = true; val4.m_syncRotation = true; val4.m_syncScale = true; val4.m_useGravity = false; ZNetView val5 = default(ZNetView); if (((Component)val4).TryGetComponent<ZNetView>(ref val5)) { val5.m_syncInitialScale = true; val5.SetLocalScale(new Vector3(scale, scale, scale)); } Projectile projectile = default(Projectile); if (Hammer_Dummy.TryGetComponent<Projectile>(ref projectile)) { val4.m_projectile = projectile; } } } public bool IsOutbound(Projectile projectile, float maxrange) { return GetDistance(projectile) > maxrange; } public bool DidHitWater(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) float liquidLevel = Floating.GetLiquidLevel(pos, 1f, (LiquidType)10); return pos.y < liquidLevel; } public float GetDistance(Projectile projectile) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)projectile.m_owner).transform.position, ((Component)projectile).gameObject.transform.position); } public void ProjectileSetup(Projectile projectile, ItemData weapon, float aoe) { //IL_0051: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (projectile.m_gravity == 0.01f) { return; } homming_animE = null; homming_dummY = weapon; projectile.m_spawnItem = weapon; projectile.m_gravity = 0.01f; projectile.m_canHitWater = false; projectile.m_stayAfterHitDynamic = false; projectile.m_stayAfterHitStatic = false; projectile.m_spawnOnHit = null; ((Component)projectile).transform.localScale = projectileScale; projectile.m_nview.m_syncInitialScale = false; projectile.m_nview.SetLocalScale(projectileScale); projectile.m_randomSpawnOnHit.Clear(); projectile.m_aoe = 0f; projectile.m_hitEffects = new EffectList(); CollectionExtensions.AddItem<EffectData>((IEnumerable<EffectData>)projectile.m_hitEffects.m_effectPrefabs, CreateEffect(Sprite_Ends)); if (isFarming) { projectile.m_aoe = aoe; if (farmingType == FarmType.Demolish) { DamageTypes damage = weapon.GetDamage(); projectile.m_damage = ((DamageTypes)(ref damage)).Clone(); projectile.m_damage.m_chop = 30f; projectile.m_damage.m_pickaxe = 30f; } else { projectile.m_damage.m_blunt = 0f; projectile.m_damage.m_chop = 0f; projectile.m_damage.m_damage = 0f; projectile.m_damage.m_fire = 0f; projectile.m_damage.m_frost = 0f; projectile.m_damage.m_lightning = 0f; projectile.m_damage.m_pickaxe = 0f; projectile.m_damage.m_pierce = 0f; projectile.m_damage.m_poison = 0f; projectile.m_damage.m_slash = 0f; projectile.m_damage.m_spirit = 0f; } } ZNetView val = default(ZNetView); if (((Component)projectile).TryGetComponent<ZNetView>(ref val) && val.IsValid()) { val.GetZDO().Persistent = false; } Rigidbody val2 = default(Rigidbody); if (((Component)projectile).TryGetComponent<Rigidbody>(ref val2)) { val2.collisionDetectionMode = (CollisionDetectionMode)3; val2.isKinematic = true; val2.useGravity = false; } } private EffectData CreateEffect(GameObject sprite) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return new EffectData { m_prefab = sprite, m_enabled = true, m_variant = -1 }; } public Vector3 GetScale() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(scale, scale, scale); } public float GetScaleValue() { return scale; } public bool IsSlingPrefab(GameObject itemdrop) { if ((Object)(object)itemdrop != (Object)null) { return ((Object)itemdrop).name == name; } return false; } public Vector3 GetOffsets(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) Vector3 val = pos; float liquidLevel = Floating.GetLiquidLevel(val, 1f, (LiquidType)10); if (pos.y < liquidLevel) { val.y = liquidLevel + 0.5f; } else { val.y += 1f; } return val; } public void SetFakeHit() { isFakeHit = true; } public bool IsFakeHit() { return isFakeHit; } public void SetFarmtype() { farmingType++; if ((int)farmingType >= farmText.Length) { farmingType = FarmType.Demolish; } CenterMessage(farmText[(int)farmingType]); } public void DelayedSlingActionUpdate() { //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) if (DelayedItemDrop_Time != -1f && DelayedItemDrop.Count > 0 && Time.time - DelayedItemDrop_Time >= DelayedPickup) { List<ItemDrop> list = new List<ItemDrop>(); foreach (KeyValuePair<ItemDrop, Humanoid> item in DelayedItemDrop) { if (!list.Contains(item.Key) && (Object)(object)item.Key != (Object)null && (Object)(object)item.Key.m_nview != (Object)null && item.Key.m_nview.IsValid() && item.Key.m_nview.IsOwner() && (Object)(object)item.Value != (Object)null && ((Character)item.Value).IsPlayer() && !((Character)item.Value).IsDead()) { item.Key.Pickup(item.Value); list.Add(item.Key); } } DelayedItemDrop_Time = -1f; DelayedItemDrop.Clear(); } if (DelayedCharacter_Time != -1f && DelayedCharacter.Count > 0 && Time.time - DelayedCharacter_Time >= DelayedPickup) { foreach (KeyValuePair<Character, Character> item2 in DelayedCharacter) { if (IsValidCharacter(item2.Key) && (Object)(object)item2.Value != (Object)null && item2.Value.IsPlayer() && !item2.Value.IsDead()) { ((Component)item2.Key).transform.position = ((Component)item2.Value).transform.position; } } DelayedCharacter_Time = -1f; DelayedCharacter.Clear(); } if (DelayedRepair_Time == -1f || DelayedRepair.Count <= 0 || !(Time.time - DelayedRepair_Time >= DelayedPickup)) { return; } int num = 0; foreach (KeyValuePair<WearNTear, Piece> item3 in DelayedRepair) { if ((Object)(object)item3.Key != (Object)null && (Object)(object)item3.Value != (Object)null && item3.Key.GetHealthPercentage() < 1f) { item3.Key.Repair(); item3.Value.m_placeEffect.Create(((Component)item3.Value).transform.position, ((Component)item3.Value).transform.rotation, (Transform)null, 1f, -1); num++; } } DelayedRepair_Time = -1f; DelayedRepair.Clear(); if (num > 0) { if (num < 2) { CenterMessage("Sling Repaired <color=green>" + num + "</color> Piece"); } else { CenterMessage("Sling Repaired <color=green>" + num + "</color> Pieces"); } } } private void CenterMessage(string text) { localHuman = ((Component)Player.m_localPlayer).GetComponent<Humanoid>(); if ((Object)(object)localHuman != (Object)null) { ((Character)localHuman).Message((MessageType)2, Localization.instance.Localize(text), 0, (Sprite)null); } } public void HommingCharacterDamageDelayStart() { homming_characterDelay = Time.time; } public void HommingCharacterDamageDelayUpdate() { if (homming_characterDelay != -1f && Time.time - homming_characterDelay > 0.1f) { homming_characterDelay = -1f; homming_characterDamage = null; } } public bool HasHommingDummy() { return homming_dummY != null; } public ItemData GetHommingDummy() { return homming_dummY; } public void AnimationSpeed() { ZSyncAnimation obj = homming_animE; if (obj != null) { obj.SetSpeed(speedAnim); } } public void HommingStart(Humanoid human, ItemData weapon) { homming_timeOut = Time.time; homming_dummY = null; homming_owneR = human; homming_animE = ((Character)human).m_zanim; homming_inventorY = human.GetInventory(); homming_characterDamage = ((Component)human).GetComponent<Character>(); isFarming = ZInput.GetKey((KeyCode)324, true); isFakeHit = false; } public void HommingEnds(Projectile projectile, Vector3 posStart, Vector3 posEnds, Quaternion rot, bool teleport, bool createStartEffect, bool createEndEffect) { //IL_007f: 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_0116: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_032c: 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_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03df: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0508: 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_052e: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) if (homming_timeOut == -1f) { return; } homming_timeOut = -1f; if (!((Object)(object)homming_owneR != (Object)null) || ((Character)homming_owneR).IsDead()) { return; } if (isFarming) { Character component = ((Component)homming_owneR).GetComponent<Character>(); switch (farmingType) { case FarmType.Demolish: { Vector3 val = posEnds; val.y += 0.3f; if ((Object)(object)Sprite_Hits[0] != (Object)null) { Object.Instantiate<GameObject>(Sprite_Hits[0], val, rot); } if ((Object)(object)Sprite_Hits[2] != (Object)null) { Object.Instantiate<GameObject>(Sprite_Hits[2], val, rot); Object.Instantiate<GameObject>(Sprite_Hits[2], val, rot); Object.Instantiate<GameObject>(Sprite_Hits[2], val, rot); } break; } case FarmType.Repair: { CreateFetchEffect(posEnds, rot, createLightning: false); List<Piece> list = new List<Piece>(); List<Piece> list2 = new List<Piece>(); Piece.GetAllPiecesInRadius(posEnds, projectile.m_aoe, list2); foreach (Piece item in list2) { if ((Object)(object)item != (Object)null && !list.Contains(item) && item.IsPlacedByPlayer()) { WearNTear component3 = ((Component)item).GetComponent<WearNTear>(); if ((Object)(object)component3 != (Object)null) { list.Add(item); KeyValuePair<WearNTear, Piece> keyValuePair2 = new KeyValuePair<WearNTear, Piece>(component3, item); DelayedRepair.Add(keyValuePair2); } } } if (DelayedRepair.Count > 0) { DelayedRepair_Time = Time.time; } break; } case FarmType.ItemFetch: CreateFetchEffect(posEnds, rot); foreach (ItemDrop s_instance in ItemDrop.s_instances) { if (IsValidItemDrop(s_instance) && s_instance.m_itemData.m_shared.m_name != projectile.m_spawnItem.m_shared.m_name && Vector3.Distance(posEnds, ((Component)s_instance).transform.position) <= projectile.m_aoe) { ItemDrop component2 = projectile.m_spawnItem.m_dropPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null && (Object)(object)s_instance != (Object)(object)component2 && ((Object)(object)s_instance.m_pickupRequester == (Object)null || (Object)(object)s_instance.m_pickupRequester == (Object)(object)component)) { KeyValuePair<ItemDrop, Humanoid> keyValuePair = new KeyValuePair<ItemDrop, Humanoid>(s_instance, homming_owneR); DelayedItemDrop.Add(keyValuePair); } } } if (DelayedItemDrop.Count > 0) { DelayedItemDrop_Time = Time.time; } break; case FarmType.FriendlyFetch: CreateFetchEffect(posEnds, rot); DelayedCharacter = GetNearbyObject(posEnds, projectile.m_aoe, ChracterkMask, FarmType.FriendlyFetch); if (DelayedCharacter.Count > 0) { DelayedCharacter_Time = Time.time; } break; case FarmType.TameableFetch: CreateFetchEffect(posEnds, rot); DelayedCharacter = GetNearbyObject(posEnds, projectile.m_aoe, ChracterkMask, FarmType.TameableFetch); if (DelayedCharacter.Count > 0) { DelayedCharacter_Time = Time.time; } break; case FarmType.EnemyFetch: CreateFetchEffect(posEnds, rot); DelayedCharacter = GetNearbyObject(posEnds, projectile.m_aoe, ChracterkMask, FarmType.EnemyFetch); if (DelayedCharacter.Count > 0) { DelayedCharacter_Time = Time.time; } break; } } else { if (createStartEffect && (Object)(object)Sprite_Start != (Object)null) { Vector3 val2 = posStart; val2.y += 1f; Object.Instantiate<GameObject>(Sprite_Start, val2, rot); } if (createEndEffect && (Object)(object)Sprite_Ends != (Object)null) { Vector3 val3 = posEnds; val3.y += 1f; Object.Instantiate<GameObject>(Sprite_Ends, val3, rot); } if (teleport) { ((Component)homming_owneR).transform.position = posEnds; } } if (homming_inventorY.AddItem(homming_dummY)) { if (homming_owneR.GetRightItem() == null) { if (homming_owneR.m_currentAttack != null) { homming_owneR.m_currentAttack.Stop(); homming_owneR.m_previousAttack = homming_owneR.m_currentAttack; homming_owneR.m_currentAttack = null; } if (!homming_owneR.EquipItem(homming_dummY, false)) { homming_retry++; homming_equipDelay = Time.time; return; } ((Character)homming_owneR).Message((MessageType)1, "$msg_added " + homming_dummY.m_shared.m_name, 1, homming_dummY.GetIcon()); } } else { Vector3 position = ((Component)homming_owneR).transform.position; position.y += 1f; ItemDrop obj = ItemDrop.DropItem(homming_dummY, 0, position, ((Component)homming_owneR).transform.rotation); if (obj != null) { obj.Pickup(homming_owneR); } } ResetHomming(); void CreateFetchEffect(Vector3 posAnimm, Quaternion rotAnimm, bool createLightning = true) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_005c: 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_0070: 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_0084: 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) Vector3 val5 = posAnimm; val5.y -= 0.6f; if ((Object)(object)Sprite_Hits[1] != (Object)null) { Object.Instantiate<GameObject>(Sprite_Hits[1], val5, rotAnimm); } if ((Object)(object)Sprite_Hits[2] != (Object)null && createLightning) { Object.Instantiate<GameObject>(Sprite_Hits[2], val5, rotAnimm); Object.Instantiate<GameObject>(Sprite_Hits[2], val5, rotAnimm); Object.Instantiate<GameObject>(Sprite_Hits[2], val5, rotAnimm); } } List<KeyValuePair<Character, Character>> GetNearbyObject(Vector3 posNear, float radiusNear, int rayMaskNear, FarmType type) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) List<Character> list3 = new List<Character>(); List<KeyValuePair<Character, Character>> list4 = new List<KeyValuePair<Character, Character>>(); Collider[] array = Physics.OverlapSphere(posNear, radiusNear, rayMaskNear); foreach (Collider val4 in array) { if (Object.op_Implicit((Object)(object)val4.attachedRigidbody)) { Character component4 = ((Component)val4.attachedRigidbody).GetComponent<Character>(); if (IsValidCharacter(component4) && ((type.Equals(FarmType.EnemyFetch) && IsMonsterFaction(component4)) || (type.Equals(FarmType.FriendlyFetch) && !IsMonsterFaction(component4)) || (type.Equals(FarmType.TameableFetch) && IsTameable(component4)))) { Character component5 = ((Component)homming_owneR).GetComponent<Character>(); if ((Object)(object)component4 != (Object)(object)component5 && !list3.Contains(component4)) { KeyValuePair<Character, Character> keyValuePair3 = new KeyValuePair<Character, Character>(component4, component5); list3.Add(component4); list4.Add(keyValuePair3); } } } } return list4; } } private bool IsValidItemDrop(ItemDrop itemDrop) { if ((Object)(object)itemDrop != (Object)null && (Object)(object)itemDrop.m_nview != (Object)null && itemDrop.m_nview.IsValid()) { return itemDrop.m_nview.IsOwner(); } return false; } private bool IsValidCharacter(Character charac) { if ((Object)(object)charac != (Object)null && (Object)(object)charac.m_nview != (Object)null && charac.m_nview.IsValid() && charac.m_nview.IsOwner()) { return !charac.IsDead(); } return false; } private bool IsMonsterFaction(Character charac) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 if ((int)charac.m_faction != 2 && (int)charac.m_faction != 3 && (int)charac.m_faction != 4 && (int)charac.m_faction != 7 && (int)charac.m_faction != 5 && (int)charac.m_faction != 6) { return (int)charac.m_faction == 9; } return true; } private bool IsTameable(Character charac) { return (Object)(object)((Component)charac).GetComponent<Tameable>() != (Object)null; } public void HommingEndRetry() { if (homming_equipDelay == -1f || !((Object)(object)homming_owneR != (Object)null) || ((Character)homming_owneR).IsDead() || !(Time.time - homming_equipDelay >= 0.1f)) { return; } if (homming_inventorY.ContainsItem(homming_dummY)) { if (homming_owneR.EquipItem(homming_dummY, false)) { ((Character)homming_owneR).Message((MessageType)1, "$msg_added " + homming_dummY.m_shared.m_name, 1, homming_dummY.GetIcon()); } else { homming_retry++; homming_equipDelay = Time.time; if (homming_retry <= 4) { return; } } } ResetHomming(); } public bool IsHommingCompleted() { if (homming_inventorY == null) { return homming_interval == -1f; } return false; } public void ResetHomming(bool isrespawn = false) { homming_interval = Time.time; homming_retry = 0; homming_timeOut = -1f; homming_equipDelay = -1f; homming_dummY = null; homming_owneR = null; homming_animE = null; homming_inventorY = null; isFarming = false; isFakeHit = false; if (isrespawn) { homming_characterDamage = null; } } public void HommingIntervalUpdate() { if (homming_interval != -1f && Time.time - homming_interval > 0.5f) { homming_interval = -1f; } } public bool IsTimedOut() { if (homming_timeOut != -1f) { return Time.time - homming_timeOut >= 3f; } return false; } }