Decompiled source of FishMon v1.3.1
plugins/HowToFishMon.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using FishNet; using FishNet.Broadcast; using FishNet.Connection; using FishNet.Managing; using FishNet.Managing.Object; using FishNet.Object; using FishNet.Serializing; using FishNet.Transporting; using HarmonyLib; using HowToFishMon.Api; using HowToFishMon.Sea; using Newtonsoft.Json; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("HowToFishMon")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3e7d8d589a89c5d98884c8536ddababdc5464176")] [assembly: AssemblyProduct("HowToFishMon")] [assembly: AssemblyTitle("HowToFishMon")] [assembly: AssemblyVersion("1.0.0.0")] namespace HowToFishMon { [HarmonyPatch(typeof(Bait), "IncreaseUnderwaterTime")] internal static class AnglerPatch { private static Action<Bait, float> _setTime; private static bool _broken; private static void Prefix(Bait __instance, out float __state) { __state = __instance.TimeUnderWater; } private static void Postfix(Bait __instance, float __state) { if (_broken) { return; } try { float num = __instance.TimeUnderWater - __state; if (num <= 0f || !Net.IsHost) { return; } FishingRod fishingRod = __instance.FishingRod; if (Object.op_Implicit((Object)(object)fishingRod) && Abilities.PlayerHas(((Item)fishingRod).Holder, Ability.Angler)) { if (_setTime == null) { _setTime = AccessTools.MethodDelegate<Action<Bait, float>>(AccessTools.PropertySetter(typeof(Bait), "TimeUnderWater"), (object)null, true); } _setTime(__instance, __instance.TimeUnderWater + num * 0.5f); } } catch (Exception ex) { _broken = true; Plugin.Log.LogWarning((object)("FishMon Angler stopped working, the game probably updated: " + ex.Message)); } } } public class Companion : MonoBehaviour { private enum State { Follow, Engage, Lunge, Recover } private const float GuardSearch = 9f; private int _lastPlayerHp = -1; private float _medicTimer = 4f; private int _medicMisses; private int _medicHpAtAsk = -1; private bool _medicWarned; private const float MerchantRange = 14f; private const float MerchantRest = 2.5f; private Item _sellTarget; private float _sellScan; private readonly Dictionary<Item, float> _restingSince = new Dictionary<Item, float>(); private readonly Dictionary<Item, float> _sellTriedAt = new Dictionary<Item, float>(); private readonly Dictionary<Item, int> _sellTries = new Dictionary<Item, int>(); private float _digTimer = TreasureHunter.NextDelay(); private const float PvpSpacing = 3.5f; private const float PvpReach = 9f; private bool _pvp; public const byte LungeState = 2; public const byte RecoverState = 3; private Vector3 _stayPos; private State _state; private Transform _body; private TrailRenderer _trail; private float _yaw; private float _hopPhase; private bool _inWater; private BossMon _boss; private float _bossRadius = 2f; private float _attackCooldown = 1f; private float _bossAttackTimer = 3f; private Move _pendingMove; private List<Move> _moves; private float _expCarry; private Vector3 _p0; private Vector3 _p1; private float _arcT; private float _arcDur; private float _arcHeight; private float _scanTimer; private Creature _wildTarget; private bool _wildKillRewarded; private Vector3 _roamGoal; private bool _hasRoamGoal; private float _roamIdle; private static bool _impactErrorLogged; private const float SpreadRadius = 5f; private const int MaxSpreadTargets = 8; private float _leftoversTimer = 5f; private StatusCond _lastStatus; private float _zzzAt; public bool InPvp => _pvp; public FishMon Mon { get; private set; } public bool Engaged { get { if (_state == State.Follow) { return _pvp; } return true; } } public BossMon Target => _boss; public float HalfHeight { get; private set; } = 0.3f; public bool InWater => _inWater; public byte StateByte => (byte)_state; public Creature OrderedTarget { get; private set; } public bool Staying { get; private set; } private float SpeedMult => (Mon.Has(Ability.Speedster) ? 1.25f : 1f) * (Statuses.Is(Mon.Status, StatusCond.Paralysis) ? 0.6f : 1f); private float MoveSpeed => (4f + (float)Mon.CalcStat(5) / 25f) * SpeedMult; private void TickGuard(Player player) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00e2: Unknown result type (might be due to invalid IL or missing references) int num = Medic.Health(player); int lastPlayerHp = _lastPlayerHp; _lastPlayerHp = num; if (Mon.Has(Ability.Guard) && num >= 0 && lastPlayerHp >= 0 && num < lastPlayerHp && (!Object.op_Implicit((Object)(object)player.Dying) || !player.Dying.IsDead) && (!Object.op_Implicit((Object)(object)OrderedTarget) || !IsValidOrder(OrderedTarget))) { Creature val = FindAttacker(player); if (Object.op_Implicit((Object)(object)val) && (_boss == null || !((Object)(object)_boss.Creature == (Object)(object)val))) { OrderAttack(val); FishMonController.AddFloat(((Component)this).transform.position + Vector3.up * (HalfHeight + 0.8f), Mon.DisplayName + " protects you!", new Color(1f, 0.6f, 0.4f)); } } } private static Creature FindAttacker(Player player) { //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_0065: 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_00cc: 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) Vector3 val = PlayerPos(player); Creature val2 = null; float num = 9f; foreach (Item value in ItemManager.Items.Values) { Creature val3 = (Object.op_Implicit((Object)(object)value) ? value.Creature : null); if (IsHostile(val3) && !Object.op_Implicit((Object)(object)((Item)val3).AttachedRod) && !Object.op_Implicit((Object)(object)((Item)val3).Holder)) { float num2 = Vector3.Distance(val, ((Component)val3).transform.position); if (num2 < num) { num = num2; val2 = val3; } } } if (Object.op_Implicit((Object)(object)val2)) { return val2; } Creature boss = BossManager.Boss; if (Object.op_Implicit((Object)(object)boss) && !boss.IsDead && !((Item)boss).IsDestroying && !BossManager.IsImmortal && Vector3.Distance(val, ((Component)boss).transform.position) <= 40f) { return boss; } return null; } private void TickMedic(Player player, float dt) { //IL_00da: 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_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_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_0135: 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) if (!Mon.Has(Ability.Medic)) { return; } _medicTimer -= dt; if (_medicTimer > 0f) { return; } _medicTimer = 4f; int num = Medic.Health(player); if (!Net.IsHost && _medicHpAtAsk >= 0) { _medicMisses = ((num <= _medicHpAtAsk) ? (_medicMisses + 1) : 0); if (_medicMisses >= 4 && !_medicWarned) { _medicWarned = true; FishMonController.ShowToast(Mon.DisplayName + " can't heal you here. The host needs the latest FishMon mod for Medic to work in their world.", (Color?)new Color(1f, 0.7f, 0.4f), 6f); } } _medicHpAtAsk = -1; if (!Medic.NeedsHealing(player)) { return; } bool flag; if (Net.IsHost) { flag = Medic.HealOnServer(player); } else { flag = Net.SendAbility(1); if (flag) { _medicHpAtAsk = num; } } if (flag && !_medicWarned) { FishMonController.AddFloat(PlayerPos(player) + Vector3.up * 2.2f, $"+{2} HP", new Color(0.5f, 1f, 0.6f), 1.2f); } } private bool TickMerchant(Player player, float dt) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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_009b: Unknown result type (might be due to invalid IL or missing references) if (!Mon.Has(Ability.Merchant)) { _sellTarget = null; return false; } _sellScan -= dt; if (_sellScan <= 0f) { _sellScan = 0.5f; ScanForSellable(player); } if (!Object.op_Implicit((Object)(object)_sellTarget)) { return false; } if (!Merchant.CanSell(_sellTarget, player)) { _sellTarget = null; return false; } Vector3 flat = Merchant.ItemPos(_sellTarget) - ((Component)this).transform.position; flat.y = 0f; float magnitude = ((Vector3)(ref flat)).magnitude; MoveFlat(flat, magnitude, MoveSpeed * 1.4f, 0.6f, dt); if (magnitude <= 1f + HalfHeight) { SellTarget(player); _sellTarget = null; } return true; } private void ScanForSellable(Player player) { //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_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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_011b: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; Vector3 val = PlayerPos(player); Item sellTarget = null; float num = float.MaxValue; HashSet<Item> seen = new HashSet<Item>(); foreach (Item value4 in ItemManager.Items.Values) { if (!Object.op_Implicit((Object)(object)value4) || !seen.Add(value4)) { continue; } if (!Merchant.CanSell(value4, player) || (_sellTries.TryGetValue(value4, out var value) && value >= 2)) { _restingSince.Remove(value4); continue; } Vector3 val2; if (Object.op_Implicit((Object)(object)value4.Rig)) { val2 = value4.Rig.linearVelocity; if (((Vector3)(ref val2)).sqrMagnitude > 0.3f) { goto IL_00d7; } } if (_restingSince.TryGetValue(value4, out var value2)) { if (!(time - value2 < 2.5f) && (!_sellTriedAt.TryGetValue(value4, out var value3) || !(time - value3 < 5f))) { val2 = Merchant.ItemPos(value4) - val; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude <= 14f && magnitude < num) { num = magnitude; sellTarget = value4; } } continue; } goto IL_00d7; IL_00d7: _restingSince[value4] = time; } foreach (Item item in _restingSince.Keys.Where((Item k) => !Object.op_Implicit((Object)(object)k) || !seen.Contains(k)).ToList()) { _restingSince.Remove(item); } foreach (Item item2 in _sellTriedAt.Keys.Where((Item k) => !Object.op_Implicit((Object)(object)k)).ToList()) { _sellTriedAt.Remove(item2); _sellTries.Remove(item2); } _sellTarget = sellTarget; } private void SellTarget(Player player) { //IL_0082: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) Item sellTarget = _sellTarget; int totalWorth = sellTarget.TotalWorth; string arg = Species.SafeName(sellTarget); _sellTriedAt[sellTarget] = Time.time; _sellTries[sellTarget] = (_sellTries.TryGetValue(sellTarget, out var value) ? value : 0) + 1; if (_sellTries[sellTarget] >= 2 && !Net.IsHost) { FishMonController.ShowToast(Mon.DisplayName + " couldn't sell that fish. The host needs the FishMon mod for Merchant to work in their world.", (Color?)new Color(1f, 0.7f, 0.4f), 6f); } else if (Net.IsHost ? Merchant.SellOnServer(sellTarget, player) : Net.SendSell(sellTarget)) { Effects(((Component)this).transform.position, "Poof", splash: false); FishMonController.AddFloat(((Component)this).transform.position + Vector3.up * (HalfHeight + 0.8f), $"+${totalWorth}", new Color(1f, 0.85f, 0.3f)); FishMonController.ShowToast($"{Mon.DisplayName} sold {arg} for ${totalWorth}.", (Color?)new Color(1f, 0.85f, 0.4f), 3f); } } private void TickTreasure(Player player, float dt) { //IL_0044: 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_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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //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_013b: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_00d7: 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_0125: Unknown result type (might be due to invalid IL or missing references) if (!Mon.Has(Ability.TreasureHunter) || Engaged) { return; } _digTimer -= dt; if (_digTimer > 0f) { return; } _digTimer = TreasureHunter.NextDelay(); Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * (HalfHeight + 0.8f) + Vector3.up * 0.6f; Vector3 worldPos = ((Component)this).transform.position + Vector3.up * (HalfHeight + 0.8f); if (Net.IsHost) { string text = TreasureHunter.DigOnServer(player, val); if (text != null) { Effects(((Component)this).transform.position, "Poof", _inWater); FishMonController.AddFloat(worldPos, "Found something!", new Color(1f, 0.85f, 0.3f)); FishMonController.ShowToast(Mon.DisplayName + " dug up " + text + "!", (Color?)new Color(1f, 0.85f, 0.4f), 4f); } } else if (Net.SendAbility(2, val)) { Effects(((Component)this).transform.position, "Poof", _inWater); FishMonController.AddFloat(worldPos, "Digging...", new Color(1f, 0.85f, 0.3f)); } } public void BeginPvp() { _pvp = true; _boss = null; _wildTarget = null; OrderedTarget = null; _hasRoamGoal = false; _moves = Mon.GetMoves(); _attackCooldown = 0.6f + Combat.Random01() * 0.8f; if (Object.op_Implicit((Object)(object)_trail)) { _trail.emitting = false; } if (_state != State.Lunge && _state != State.Recover) { _state = State.Engage; } } public void EndPvp() { _pvp = false; _boss = null; _pendingMove = null; _hasRoamGoal = false; _state = State.Follow; if (Object.op_Implicit((Object)(object)_trail)) { _trail.emitting = false; } } private void UpdatePvp(float dt) { if (TickStatus() || !_pvp) { return; } TickItem(dt); switch (_state) { case State.Lunge: DoArc(dt, lunge: true); break; case State.Recover: DoArc(dt, lunge: false); break; default: _state = State.Engage; if (!Statuses.CantAct(Mon.Status)) { DoPvpEngage(dt); } break; } AnimateBody(dt); } private void DoPvpEngage(float dt) { //IL_0018: 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_004a: 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_0057: 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_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0099: 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_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_01da: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) RemoteCompanion opponentBody = Battle.OpponentBody; bool flag = Battle.State == Battle.Phase.Fighting && Object.op_Implicit((Object)(object)opponentBody); Vector3 arena = Battle.Arena; Vector3 val; Vector3 val2; if (!flag) { val = Battle.HomeSpot; val2 = (Object.op_Implicit((Object)(object)opponentBody) ? ((Component)opponentBody).transform.position : arena); } else { Vector3 position = ((Component)opponentBody).transform.position; Vector3 val3 = ((Component)this).transform.position - position; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.25f) { val3 = Battle.OurSide; } val = position + ((Vector3)(ref val3)).normalized * 3.5f; Vector3 val4 = val - arena; val4.y = 0f; if (((Vector3)(ref val4)).magnitude > 9f) { val = arena + ((Vector3)(ref val4)).normalized * 9f; } val2 = position; } Vector3 flat = val - ((Component)this).transform.position; flat.y = 0f; float magnitude = ((Vector3)(ref flat)).magnitude; if (magnitude > 40f) { Effects(((Component)this).transform.position, "Poof", splash: true); ((Component)this).transform.position = new Vector3(val.x, SurfaceY(val, out _inWater) + HalfHeight, val.z); Effects(((Component)this).transform.position, "Poof", splash: true); return; } MoveFlat(flat, magnitude, MoveSpeed * ((magnitude > 8f) ? 2f : 1.2f), 0.6f, dt); Vector3 val5 = val2 - ((Component)this).transform.position; val5.y = 0f; if (magnitude < 1.2f && ((Vector3)(ref val5)).sqrMagnitude > 0.01f) { Quaternion val6 = Quaternion.LookRotation(val5); FaceYaw(((Quaternion)(ref val6)).eulerAngles.y, dt * 6f); } if (!flag) { return; } _attackCooldown -= dt; if (_attackCooldown > 0f || ((Vector3)(ref val5)).magnitude > 9f) { return; } if (Statuses.Is(Mon.Status, StatusCond.Paralysis) && Combat.Random01() < 0.25f) { _attackCooldown = 1.5f; FishMonController.AddFloat(((Component)this).transform.position + Vector3.up * (HalfHeight + 0.6f), Mon.DisplayName + " is paralyzed! It can't move!", Statuses.ColorOf(StatusCond.Paralysis)); return; } FishMon opponent = Battle.Opponent; if (opponent != null) { _pendingMove = Combat.PickMove(_moves, Mon.Type1, Mon.Type2, opponent.Type1, opponent.Type2); _bossRadius = Mathf.Max(0.5f, opponentBody.HalfHeight); LeapAt(((Component)opponentBody).transform.position); } } private void PvpImpact() { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_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_0039: 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_005b: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_00cc: 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_020a: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) FishMon opponent = Battle.Opponent; Move pendingMove = _pendingMove; if (opponent == null || pendingMove == null || Battle.State != Battle.Phase.Fighting) { return; } Vector3 position = ((Component)this).transform.position; Vector3 val = _p1 - _p0; Vector3 normalized = ((Vector3)(ref val)).normalized; HitResult h = Combat.FishHitsFish(Mon, opponent, pendingMove); if (h.Missed) { FishMonController.AddFloat(position, "Missed!", Color.gray); Net.SendAttack(2, pendingMove, position, normalized, 1f, crit: false, _inWater); return; } if (h.Eff <= 0f) { FishMonController.AddFloat(position, "No effect...", Color.gray); Net.SendAttack(2, pendingMove, position, normalized, 0f, crit: false, _inWater); return; } if (Plugin.AttackEffects.Value) { Fx.Impact(pendingMove, position, normalized, h.Eff, h.Crit); } else { try { AudioManager.PlayClipAt("FishPunchHit", position, true, (AudioDistance)2, 0.6f, 0.1f); } catch { } } Net.SendAttack(1, pendingMove, position, normalized, h.Eff, h.Crit, _inWater); Battle.SendHit(pendingMove, h); FishMonController.AddFloat(position + Vector3.up * 0.2f, "-" + h.Damage, new Color(1f, 0.9f, 0.6f)); string text = ((h.Eff >= 2f) ? "Super effective!" : ((h.Eff < 1f) ? "Not very effective..." : "")); if (h.Crit) { text = "Critical hit! " + text; } if (text.Length > 0) { FishMonController.AddFloat(position + Vector3.up * 0.7f, text, (h.Eff >= 2f) ? new Color(0.7f, 1f, 0.5f) : new Color(1f, 0.85f, 0.5f)); } float num = pendingMove.DrainPercent + (Mon.Has(Ability.Leech) ? 0.15f : 0f); if (num > 0f) { int num2 = Mathf.Max(1, Mathf.RoundToInt((float)h.Damage * num)); Mon.CurrentHp = Mathf.Min(Mon.MaxHp, Mon.CurrentHp + num2); FishMonController.AddFloat(((Component)this).transform.position + Vector3.up, "+" + num2, new Color(0.5f, 1f, 0.5f)); } } public void TakePvpHit(Move move, int dmg, float eff, bool crit) { //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_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_0040: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_0233: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_02b6: 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_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: 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_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) if (!_pvp || Mon.Fainted || dmg <= 0) { return; } Vector3 val = ((Component)this).transform.position + Vector3.up * (HalfHeight + 0.4f); string arg = ((Battle.Opponent != null) ? Battle.Opponent.DisplayName : "The other FishMon"); if (Mon.Holds(HeldItem.FocusSash) && Mon.CurrentHp >= Mon.MaxHp && dmg >= Mon.CurrentHp && Mon.MaxHp > 1) { dmg = Mon.CurrentHp - 1; UseUpItem("hung on using its Focus Sash!"); } Mon.CurrentHp = Mathf.Max(0, Mon.CurrentHp - dmg); FishMonController.AddFloat(val, $"{arg} used {move.Name}! -{dmg}", new Color(1f, 0.45f, 0.4f)); try { AudioManager.PlayClipAt("FishPunchHit", ((Component)this).transform.position, true, (AudioDistance)1, 0.5f, 0.1f); } catch { } if (Mon.Fainted) { if (Plugin.AttackEffects.Value) { Fx.Burst(((Component)this).transform.position, new Color(1f, 0.5f, 0.5f), 12); } Battle.Lose(); return; } if (Statuses.TryThaw(Mon.Status, move)) { FishMonController.AddFloat(val + Vector3.up * 0.5f, Mon.DisplayName + Statuses.Cured(StatusCond.Freeze), Statuses.ColorOf(StatusCond.Freeze)); } else if (Statuses.TryInflict(Mon.Status, move, Mon.Type1, Mon.Type2, boss: false)) { FishMonController.ShowToast(Mon.DisplayName + " " + Statuses.Inflicted(Mon.Status.Cond), Statuses.ColorOf(Mon.Status.Cond), 3f); } if (_state == State.Engage) { RemoteCompanion opponentBody = Battle.OpponentBody; Vector3 val2 = (Object.op_Implicit((Object)(object)opponentBody) ? (((Component)this).transform.position - ((Component)opponentBody).transform.position) : Battle.OurSide); val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = -((Component)this).transform.forward; } _p0 = ((Component)this).transform.position; _p1 = ((Component)this).transform.position + ((Vector3)(ref val2)).normalized * 2.5f; _p1.y = SurfaceY(_p1, out var _) + HalfHeight; _arcDur = 0.45f; _arcHeight = 1.2f; _arcT = 0f; _state = State.Recover; } } public static Vector3 PlayerPos(Player p) { //IL_0008: 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_0046: 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) if (!Object.op_Implicit((Object)(object)p)) { return Vector3.zero; } if (Object.op_Implicit((Object)(object)p.Transform)) { return p.Transform.position; } if (Object.op_Implicit((Object)(object)p.Rigidbody)) { return p.Rigidbody.position; } return ((Component)p).transform.position; } public static float PlayerYaw(Player p) { //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_0035: 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) if (!Object.op_Implicit((Object)(object)p)) { return 0f; } if (Object.op_Implicit((Object)(object)p.CamObject)) { return p.CamObject.eulerAngles.y; } Quaternion curPlayerRot = p.CurPlayerRot; return ((Quaternion)(ref curPlayerRot)).eulerAngles.y; } public static Vector3 PlayerForward(Player p) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(0f, PlayerYaw(p), 0f) * Vector3.forward; } public void OrderAttack(Creature c) { OrderedTarget = c; _wildTarget = null; if (_state == State.Engage) { _state = State.Follow; } } public void OrderStay() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) Staying = true; _stayPos = ((Component)this).transform.position; OrderedTarget = null; } public void OrderFollow() { Staying = false; OrderedTarget = null; } public void CopyOrdersFrom(Companion other) { //IL_0023: 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) if (Object.op_Implicit((Object)(object)other)) { OrderedTarget = other.OrderedTarget; Staying = other.Staying; _stayPos = other._stayPos; } } public static Companion Spawn(FishMon mon, Vector3 nearPos) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Companion companion = new GameObject("FishMon_" + mon.DisplayName).AddComponent<Companion>(); companion.Init(mon, nearPos); return companion; } private void Init(FishMon mon, Vector3 pos) { //IL_0019: 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_0092: 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_00ab: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) Mon = mon; _moves = mon.GetMoves(); _body = new GameObject("Body").transform; _body.SetParent(((Component)this).transform, false); BuildModel(mon, _body, out var halfHeight, out var parts, out var prefabLayer); HalfHeight = halfHeight; int num = PickVisibleLayer(prefabLayer); Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = num; } ((Component)this).transform.position = new Vector3(pos.x, SurfaceY(pos, out _inWater) + HalfHeight, pos.z); _yaw = (Object.op_Implicit((Object)(object)Player.LocalPlayer) ? PlayerYaw(Player.LocalPlayer) : 0f); ((Component)this).transform.rotation = Quaternion.Euler(0f, _yaw, 0f); Effects(((Component)this).transform.position, "Poof", splash: true); _trail = Fx.AddTrail(((Component)this).gameObject, TypeChart.ColorOf(mon.Type1), Mathf.Max(0.15f, HalfHeight * 1.2f)); if (Object.op_Implicit((Object)(object)_trail)) { ((Component)_trail).gameObject.layer = num; } if (mon.Stage >= 2) { GameObject val = new GameObject("Aura"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = Vector3.up * HalfHeight; Light obj = val.AddComponent<Light>(); obj.type = (LightType)2; obj.color = TypeChart.ColorOf(mon.Type1); obj.range = 2.5f + HalfHeight * 3f; obj.intensity = 1.5f; obj.shadows = (LightShadows)0; } Plugin.Log.LogInfo((object)($"Sent out {mon.DisplayName} ({mon.SpeciesName}, id {mon.SpeciesId}): " + ((parts > 0) ? (parts + " model parts") : "stand-in capsule") + $", layer {num} ({LayerMask.LayerToName(num)}), halfHeight {HalfHeight:0.00}, at {((Component)this).transform.position}, inWater {_inWater}, requested {pos}")); } public void RefreshMoves() { _moves = Mon.GetMoves(); } public void Despawn(bool effects = true) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (effects) { Effects(((Component)this).transform.position, "Poof", splash: true); } Object.Destroy((Object)(object)((Component)this).gameObject); } internal static void BuildModel(FishMon mon, Transform parent, out float halfHeight, out int parts, out int prefabLayer) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0120: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) Transform transform = new GameObject("Model").transform; transform.SetParent(parent, false); bool flag = false; parts = 0; prefabLayer = -1; try { GameObject val = StageVisual(mon); parts = (Object.op_Implicit((Object)(object)val) ? CopyVisualTree(val, mon.Shiny, transform, out prefabLayer) : CopyPrefabVisuals(mon.SpeciesId, mon.Shiny, transform, out prefabLayer)); flag = parts > 0; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Couldn't copy fish model, using a stand-in: " + ex.Message)); } if (!flag) { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)1); Object.Destroy((Object)(object)obj.GetComponent<Collider>()); obj.transform.SetParent(transform, false); obj.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); obj.transform.localScale = new Vector3(0.35f, 0.4f, 0.3f); obj.GetComponent<Renderer>().material.color = TypeChart.ColorOf(mon.Type1); } Bounds val2 = LocalBounds(transform); float num = Mathf.Max(0.05f, Mathf.Max(((Bounds)(ref val2)).size.x, Mathf.Max(((Bounds)(ref val2)).size.y, ((Bounds)(ref val2)).size.z))); float num2 = Mathf.Clamp(num * 1.6f, 0.8f, 3.2f) * Mathf.Max(0.1f, Plugin.CompanionScale.Value) * (1f + (float)mon.Level / 250f) * (1f + 0.3f * (float)mon.Stage) / num; transform.localScale = Vector3.one * num2; transform.localPosition = -((Bounds)(ref val2)).center * num2; halfHeight = Mathf.Max(0.15f, ((Bounds)(ref val2)).extents.y * num2); } internal static GameObject StageVisual(FishMon mon) { EvoStage[] array = FishMonAPI.FromId(mon.SpeciesId)?.Evolutions; if (array == null) { return null; } for (int num = Mathf.Min(mon.Stage, array.Length) - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)array[num]?.Visual)) { return array[num].Visual; } } return null; } internal static int CopyVisualTree(GameObject root, bool shiny, Transform model, out int layer) { //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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) layer = -1; int num = 0; Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (!val.enabled) { continue; } SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); object obj; if (val2 == null) { MeshFilter component = ((Component)val).GetComponent<MeshFilter>(); obj = ((component != null) ? component.sharedMesh : null); } else { obj = val2.sharedMesh; } Mesh val3 = (Mesh)obj; if (!Object.op_Implicit((Object)(object)val3)) { continue; } GameObject val4 = new GameObject(((Object)val).name); val4.transform.SetParent(model, false); Matrix4x4 val5 = root.transform.worldToLocalMatrix * ((Component)val).transform.localToWorldMatrix; val4.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val5)).GetColumn(3)); val4.transform.localRotation = ((Matrix4x4)(ref val5)).rotation; val4.transform.localScale = ((Matrix4x4)(ref val5)).lossyScale; val4.AddComponent<MeshFilter>().sharedMesh = val3; MeshRenderer val6 = val4.AddComponent<MeshRenderer>(); ((Renderer)val6).sharedMaterials = val.sharedMaterials; if (shiny) { Material[] materials = ((Renderer)val6).materials; Material[] array = materials; foreach (Material val7 in array) { if (val7.HasProperty("_Rainbow_Skin")) { val7.SetFloat("_Rainbow_Skin", 1f); } } ((Renderer)val6).materials = materials; } if (layer < 0) { layer = ((Component)val).gameObject.layer; } num++; } return num; } internal static int CopyPrefabVisuals(byte speciesId, bool shiny, Transform model, out int layer) { //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: 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_02d3: Unknown result type (might be due to invalid IL or missing references) layer = -1; Item val = GameInfo.IDToItem(speciesId); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)$"No prefab found for item id {speciesId}"); return 0; } Transform root = ((Component)val).transform; Traverse val2 = Traverse.Create((object)val); GameObject value = val2.Field<GameObject>("_enableOnShiny").Value; Transform enableShiny = ((value != null) ? value.transform : null); GameObject value2 = val2.Field<GameObject>("_disableOnShiny").Value; Transform disableShiny = ((value2 != null) ? value2.transform : null); GameObject value3 = val2.Field<GameObject>("_inHandHolder").Value; Transform parentT = ((value3 != null) ? value3.transform : null); Transform value4 = val2.Field<Transform>("_handModelRight").Value; Transform value5 = val2.Field<Transform>("_handModelLeft").Value; Mesh value6 = val2.Field<Mesh>("_mesh").Value; Mesh value7 = val2.Field<Mesh>("_dripMesh").Value; HashSet<Renderer> hashSet = new HashSet<Renderer>(); LODGroup[] componentsInChildren = ((Component)val).GetComponentsInChildren<LODGroup>(true); Renderer[] renderers; for (int i = 0; i < componentsInChildren.Length; i++) { LOD[] lODs = componentsInChildren[i].GetLODs(); for (int j = 1; j < lODs.Length; j++) { renderers = lODs[j].renderers; foreach (Renderer val3 in renderers) { if (Object.op_Implicit((Object)(object)val3)) { hashSet.Add(val3); } } } } int num = 0; renderers = ((Component)val).GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in renderers) { if (!val4.enabled || hashSet.Contains(val4)) { continue; } Mesh val5 = null; SkinnedMeshRenderer val6 = (SkinnedMeshRenderer)(object)((val4 is SkinnedMeshRenderer) ? val4 : null); if (val6 != null) { val5 = val6.sharedMesh; } else if (val4 is MeshRenderer) { MeshFilter component = ((Component)val4).GetComponent<MeshFilter>(); val5 = ((component != null) ? component.sharedMesh : null); } if (!Object.op_Implicit((Object)(object)val5)) { continue; } Transform transform = ((Component)val4).transform; if (!Under(transform, parentT) && !Under(transform, value4) && !Under(transform, value5) && !(shiny ? Under(transform, disableShiny) : Under(transform, enableShiny)) && ActiveInPrefab(transform)) { if (shiny && Object.op_Implicit((Object)(object)value7) && (Object)(object)val5 == (Object)(object)value6) { val5 = value7; } GameObject val7 = new GameObject(((Object)val4).name); val7.transform.SetParent(model, false); Matrix4x4 val8 = root.worldToLocalMatrix * transform.localToWorldMatrix; val7.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val8)).GetColumn(3)); val7.transform.localRotation = ((Matrix4x4)(ref val8)).rotation; val7.transform.localScale = ((Matrix4x4)(ref val8)).lossyScale; val7.AddComponent<MeshFilter>().sharedMesh = val5; ((Renderer)val7.AddComponent<MeshRenderer>()).sharedMaterials = val4.sharedMaterials; if (layer < 0) { layer = ((Component)val4).gameObject.layer; } num++; } } return num; bool ActiveInPrefab(Transform t) { Transform val9 = t; while (Object.op_Implicit((Object)(object)val9) && (Object)(object)val9 != (Object)(object)root.parent) { if (!((Component)val9).gameObject.activeSelf && !((Object)(object)val9 == (Object)(object)enableShiny) && !((Object)(object)val9 == (Object)(object)disableShiny)) { return false; } val9 = val9.parent; } return true; } static bool Under(Transform t, Transform val9) { if (Object.op_Implicit((Object)(object)val9)) { if (!((Object)(object)t == (Object)(object)val9)) { return t.IsChildOf(val9); } return true; } return false; } } internal static Bounds LocalBounds(Transform model) { //IL_0004: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_0122: 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_0131: 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_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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) bool flag = false; Bounds result = default(Bounds); MeshFilter[] componentsInChildren = ((Component)model).GetComponentsInChildren<MeshFilter>(); foreach (MeshFilter val in componentsInChildren) { if (!Object.op_Implicit((Object)(object)val.sharedMesh)) { continue; } Bounds bounds = val.sharedMesh.bounds; Matrix4x4 val2 = Matrix4x4.TRS(((Component)val).transform.localPosition, ((Component)val).transform.localRotation, ((Component)val).transform.localScale); if ((Object)(object)((Component)val).transform.parent != (Object)(object)model) { val2 = model.worldToLocalMatrix * ((Component)val).transform.localToWorldMatrix; } for (int j = 0; j < 8; j++) { Vector3 val3 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)))); Vector3 val4 = ((Matrix4x4)(ref val2)).MultiplyPoint3x4(val3); if (!flag) { ((Bounds)(ref result))..ctor(val4, Vector3.zero); flag = true; } else { ((Bounds)(ref result)).Encapsulate(val4); } } } if (!flag) { return new Bounds(Vector3.zero, Vector3.one * 0.5f); } return result; } internal static int PickVisibleLayer(int preferred) { Player localPlayer = Player.LocalPlayer; Camera val = ((Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)localPlayer.CurCam)) ? localPlayer.CurCam : Camera.main); if (!Object.op_Implicit((Object)(object)val)) { if (preferred < 0) { return 0; } return preferred; } int cullingMask = val.cullingMask; if (preferred >= 0 && (cullingMask & (1 << preferred)) != 0) { return preferred; } if ((cullingMask & 1) != 0) { return 0; } for (int i = 0; i < 32; i++) { if ((cullingMask & (1 << i)) != 0) { return i; } } return 0; } private static float SurfaceY(Vector3 pos, out bool water) { //IL_001b: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0045: 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_0073: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_00d8: Unknown result type (might be due to invalid IL or missing references) float num = -10000f; try { num = WaterManager.WaterHeight; } catch { } float num2 = -10000f; bool flag = false; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(pos.x, pos.y + 25f, pos.z); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 120f, LayerMask.op_Implicit(GameInfo.LevelLayer), (QueryTriggerInteraction)1)) { num2 = ((RaycastHit)(ref val2)).point.y; flag = true; } else { float num3 = -10000f; RaycastHit[] array = Physics.RaycastAll(val, Vector3.down, 120f, -5, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (!Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Player>()) && (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val3)).rigidbody) || ((RaycastHit)(ref val3)).rigidbody.isKinematic) && ((RaycastHit)(ref val3)).point.y > num3) { num3 = ((RaycastHit)(ref val3)).point.y; } } if (num3 > -9999f) { num2 = num3; flag = true; } } if (!flag) { if (num > -9999f) { water = true; return num - 0.1f; } water = false; Player localPlayer = Player.LocalPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { return pos.y; } return PlayerPos(localPlayer).y; } water = num > num2; if (!water) { return num2; } return num - 0.1f; } private static void Effects(Vector3 pos, string sound, bool splash) { //IL_0001: 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_0021: Unknown result type (might be due to invalid IL or missing references) try { AudioManager.PlayClipAt(sound, pos, true, (AudioDistance)1, 0.5f, 0.1f); } catch { } if (splash) { try { VFXManager.Play("WaterSplash", pos, Vector3.zero); } catch { } } } private void Update() { Player localPlayer = Player.LocalPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || Mon == null) { return; } float deltaTime = Time.deltaTime; if (deltaTime <= 0f) { return; } if (_pvp) { UpdatePvp(deltaTime); return; } TickGuard(localPlayer); UpdateTarget(localPlayer); TickMedic(localPlayer, deltaTime); TickTreasure(localPlayer, deltaTime); if (TickStatus()) { return; } TickItem(deltaTime); if (!Statuses.CantAct(Mon.Status) || (_state != State.Follow && _state != State.Engage)) { switch (_state) { case State.Follow: DoFollow(localPlayer, deltaTime); break; case State.Engage: DoEngage(deltaTime); break; case State.Lunge: DoArc(deltaTime, lunge: true); break; case State.Recover: DoArc(deltaTime, lunge: false); break; } } if (_state == State.Engage || _state == State.Lunge || _state == State.Recover) { BossCounterAttack(deltaTime); } AnimateBody(deltaTime); } private static bool IsHostile(Creature c) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)c) && !c.IsDead && !((Item)c).IsDestroying && !Object.op_Implicit((Object)(object)((Item)c).Bird) && (int)c.BossType == 0) { if (!(c is Crab)) { return c is AttackingFish; } return true; } return false; } private static bool IsValidOrder(Creature c) { if (Object.op_Implicit((Object)(object)c) && !c.IsDead && !((Item)c).IsDestroying) { return !Object.op_Implicit((Object)(object)((Item)c).Holder); } return false; } private Creature FindTarget(Player player) { //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_0021: 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_00c0: 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_007b: 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_016d: 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) Vector3 val = PlayerPos(player); if (Object.op_Implicit((Object)(object)OrderedTarget)) { if (IsValidOrder(OrderedTarget) && Vector3.Distance(val, ((Component)OrderedTarget).transform.position) <= 120f) { return OrderedTarget; } OrderedTarget = null; } if (Staying) { return null; } Creature boss = BossManager.Boss; if (Object.op_Implicit((Object)(object)boss) && !boss.IsDead && !((Item)boss).IsDestroying && !BossManager.IsImmortal && Vector3.Distance(val, ((Component)boss).transform.position) <= Plugin.AggroRange.Value) { return boss; } if (!Plugin.FightWildCreatures.Value) { return null; } float value = Plugin.WildAggroRange.Value; if (IsHostile(_wildTarget) && Vector3.Distance(val, ((Component)_wildTarget).transform.position) <= value * 1.5f) { return _wildTarget; } _scanTimer -= Time.deltaTime; if (_scanTimer > 0f) { return null; } _scanTimer = 0.5f; Creature val2 = null; float num = value; foreach (Item value2 in ItemManager.Items.Values) { Creature val3 = (Object.op_Implicit((Object)(object)value2) ? value2.Creature : null); if (IsHostile(val3) && !Object.op_Implicit((Object)(object)((Item)val3).AttachedRod) && !Object.op_Implicit((Object)(object)((Item)val3).Holder)) { float num2 = Vector3.Distance(val, ((Component)val3).transform.position); if (num2 < num) { num = num2; val2 = val3; } } } _wildTarget = val2; return val2; } private void UpdateTarget(Player player) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: 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_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) if (_boss != null && !_boss.IsBoss && Object.op_Implicit((Object)(object)_boss.Creature) && _boss.Creature.IsDead && !_wildKillRewarded) { _wildKillRewarded = true; int num = Mathf.Max(1, Mathf.RoundToInt((float)_boss.FullExp * 0.5f)); FishMonController.AddFloat(((Component)this).transform.position + Vector3.up, $"{_boss.Name} defeated! +{num} exp", new Color(1f, 0.85f, 0.4f)); FishMonController.GiveExp(Mon, num, new int[6] { 0, 1, 0, 0, 0, 0 }); FishMonStorage.Save(); } Creature val = FindTarget(player); if (!Object.op_Implicit((Object)(object)val)) { if (_boss != null && _state != State.Lunge) { _boss = null; _state = State.Follow; } return; } if (_boss == null || (Object)(object)_boss.Creature != (Object)(object)val) { Creature val2 = val; _boss = BossMon.From(val2); _wildKillRewarded = false; Fishdex.MarkSeen(val2); Plugin.Log.LogInfo((object)string.Format("{0} targets {1} ({2}, Lv {3}, HP {4}/{5})", Mon.DisplayName, _boss.Name, _boss.IsBoss ? "boss" : "wild", _boss.Level, _boss.RealHp, _boss.RealMaxHp)); Renderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Renderer>(); if (componentsInChildren.Length != 0) { Bounds bounds = componentsInChildren[0].bounds; Renderer[] array = componentsInChildren; foreach (Renderer val3 in array) { ((Bounds)(ref bounds)).Encapsulate(val3.bounds); } _bossRadius = Mathf.Clamp(Mathf.Max(((Bounds)(ref bounds)).extents.x, ((Bounds)(ref bounds)).extents.z), 0.5f, 25f); } _attackCooldown = 0.6f; _bossAttackTimer = 2.5f + Combat.Random01() * 2f; if (_boss.IsBoss) { FishMonController.Participants.Add(Mon); Badges.OnJoined(val2, Mon); } FishMonController.AddFloat(((Component)this).transform.position + Vector3.up, Mon.DisplayName + " charges in!", new Color(0.6f, 0.85f, 1f)); } if (_state == State.Follow) { _state = State.Engage; } } private void DoFollow(Player player, float dt) { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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) Vector3 val = PlayerForward(player); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(Vector3.up, val); if (!Staying && TickMerchant(player, dt)) { return; } if (!Staying && Plugin.RoamAroundYou.Value) { DoRoam(player, val, dt); return; } Vector3 val3 = (Staying ? _stayPos : (PlayerPos(player) - val * 2.2f + val2 * 1.5f)); Vector3 flat = val3 - ((Component)this).transform.position; flat.y = 0f; float magnitude = ((Vector3)(ref flat)).magnitude; if (Staying) { MoveFlat(flat, magnitude, MoveSpeed, 0.4f, dt); return; } if (magnitude > 35f) { Effects(((Component)this).transform.position, "Poof", splash: true); ((Component)this).transform.position = new Vector3(val3.x, SurfaceY(val3, out _inWater) + HalfHeight, val3.z); Effects(((Component)this).transform.position, "Poof", splash: true); return; } MoveFlat(flat, magnitude, (magnitude > 8f) ? (MoveSpeed * 2f) : MoveSpeed, 0.6f, dt); if (magnitude < 0.6f) { FaceYaw(PlayerYaw(player), dt * 2f); } } private void DoRoam(Player player, Vector3 fwd, float dt) { //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_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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00e3: 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_0068: 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_0077: 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_0094: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: 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) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) Vector3 val = PlayerPos(player); float num = Mathf.Max(2.5f, Plugin.RoamRadius.Value); if (Mon.Has(Ability.Guard)) { num = Mathf.Min(num, 3.5f); } Vector3 val2 = ((Component)this).transform.position - val; val2.y = 0f; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > 35f + num) { Vector3 val3 = PickRoamSpot(val, fwd, num); Effects(((Component)this).transform.position, "Poof", splash: true); ((Component)this).transform.position = new Vector3(val3.x, SurfaceY(val3, out _inWater) + HalfHeight, val3.z); Effects(((Component)this).transform.position, "Poof", splash: true); _hasRoamGoal = false; return; } Vector3 val4 = _roamGoal - val; val4.y = 0f; bool flag = ((Vector3)(ref val4)).magnitude > num + 1.5f; bool num2 = magnitude > num + 3f; if (!_hasRoamGoal || flag || (_roamIdle <= 0f && ReachedRoamGoal())) { _roamGoal = PickRoamSpot(val, fwd, num); _hasRoamGoal = true; _roamIdle = Random.Range(1.5f, 4.5f); } Vector3 flat = _roamGoal - ((Component)this).transform.position; flat.y = 0f; float magnitude2 = ((Vector3)(ref flat)).magnitude; float speed = (num2 ? (MoveSpeed * 2f) : ((magnitude2 > 6f) ? MoveSpeed : (MoveSpeed * 0.55f))); MoveFlat(flat, magnitude2, speed, 0.5f, dt); if (magnitude2 <= 0.5f) { _roamIdle -= dt; Vector3 val5 = val - ((Component)this).transform.position; val5.y = 0f; if (((Vector3)(ref val5)).sqrMagnitude > 0.01f) { Quaternion val6 = Quaternion.LookRotation(val5); FaceYaw(((Quaternion)(ref val6)).eulerAngles.y, dt * 2f); } } } private bool ReachedRoamGoal() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector3 val = _roamGoal - ((Component)this).transform.position; val.y = 0f; return ((Vector3)(ref val)).magnitude <= 0.6f; } private Vector3 PickRoamSpot(Vector3 me, Vector3 fwd, float radius) { //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_0006: 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_005b: 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_006c: 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_0077: 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) Quaternion val = Quaternion.LookRotation(fwd); float y = ((Quaternion)(ref val)).eulerAngles.y; float num = ((Random.value < 0.8f) ? (y + Random.Range(-55f, 55f)) : Random.Range(0f, 360f)); float num2 = Random.Range(Mathf.Min(2f, radius * 0.5f), radius); return me + Quaternion.Euler(0f, num, 0f) * Vector3.forward * num2; } private void DoEngage(float dt) { //IL_0023: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0089: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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_0055: 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_0125: 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_00f1: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) if (_boss == null || _boss.Dead) { _state = State.Follow; return; } Vector3 center = _boss.Center; Vector3 val = ((Component)this).transform.position - center; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } Vector3 flat = center + ((Vector3)(ref val)).normalized * (_bossRadius + 3f) - ((Component)this).transform.position; flat.y = 0f; MoveFlat(flat, ((Vector3)(ref flat)).magnitude, MoveSpeed * 1.3f, 0.8f, dt); Vector3 val2 = center - ((Component)this).transform.position; val2.y = 0f; if (((Vector3)(ref flat)).magnitude < 1.5f && ((Vector3)(ref val2)).sqrMagnitude > 0.01f) { Quaternion val3 = Quaternion.LookRotation(val2); FaceYaw(((Quaternion)(ref val3)).eulerAngles.y, dt * 6f); } _attackCooldown -= dt; float num = Vector3.Distance(((Component)this).transform.position, center) - _bossRadius; if (_attackCooldown <= 0f && num < 9f) { if (Statuses.Is(Mon.Status, StatusCond.Paralysis) && Combat.Random01() < 0.25f) { _attackCooldown = 1.5f; FishMonController.AddFloat(((Component)this).transform.position + Vector3.up * (HalfHeight + 0.6f), Mon.DisplayName + " is paralyzed! It can't move!", Statuses.ColorOf(StatusCond.Paralysis)); } else { StartLunge(); } } } private void MoveFlat(Vector3 flat, float dist, float speed, float stopDist, 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_007c: 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_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_002d: 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_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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position; bool flag = dist > stopDist; if (flag) { Vector3 val2 = ((Vector3)(ref flat)).normalized * Mathf.Min(dist, speed * dt); val += val2; Quaternion val3 = Quaternion.LookRotation(flat); FaceYaw(((Quaternion)(ref val3)).eulerAngles.y, dt * 8f); _hopPhase += dt * (_inWater ? 6f : 9f); } float num = SurfaceY(val, out _inWater) + HalfHeight; float num2 = 0f; if (!_inWater && flag) { num2 = Mathf.Abs(Mathf.Sin(_hopPhase)) * 0.45f; } if (_inWater) { num2 = Mathf.Sin(Time.time * 2.2f) * 0.06f; } val.y = Mathf.Lerp(val.y, num + num2, 1f - Mathf.Exp((0f - dt) * 14f)); ((Component)this).transform.position = val; } private void FaceYaw(float target, float t) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) _yaw = Mathf.LerpAngle(_yaw, target, Mathf.Clamp01(t)); ((Component)this).transform.rotation = Quaternion.Euler(0f, _yaw, 0f); } private void AnimateBody(float dt) { //IL_0043: 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_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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_body)) { float time = Time.time; Quaternion val = ((_state == State.Lunge) ? Quaternion.Euler(Mathf.Lerp(-30f, 35f, _arcT), 0f, _arcT * 360f) : ((!_inWater) ? Quaternion.Euler(0f, Mathf.Sin(time * 11f) * 10f, Mathf.Sin(time * 9f) * 18f) : Quaternion.Euler(0f, Mathf.Sin(time * 7f) * 12f, 0f))); _body.localRotation = Quaternion.Slerp(_body.localRotation, val, 1f - Mathf.Exp((0f - dt) * 12f)); } } private void StartLunge() { //IL_003a: 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_005e: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_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) _pendingMove = Combat.PickMove(_moves, Mon.Type1, Mon.Type2, _boss.Type1, _boss.Type2, SpreadTargets(_boss.Center).Count); Vector3 center = _boss.Center; Vector3 val = ((Component)this).transform.position - center; LeapAt(center + Vector3.ClampMagnitude(val, _bossRadius * 0.5f)); } private void LeapAt(Vector3 hitPoint) { //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_0012: 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_0019: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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) _p0 = ((Component)this).transform.position; _p1 = hitPoint; float num = Vector3.Distance(_p0, _p1); _arcDur = Mathf.Clamp(num / 16f, 0.3f, 1f); _arcHeight = Mathf.Clamp(num * 0.35f, 0.8f, 5f); _arcT = 0f; _state = State.Lunge; FishMonController.AddFloat(((Component)this).transform.position + Vector3.up * (HalfHeight + 0.6f), _pendingMove.Name + "!", TypeChart.ColorOf(_pendingMove.Type)); if (_inWater) { Effects(((Component)this).transform.position, "FishCaught_Splash", splash: true); } Move pendingMove = _pendingMove; Vector3 position = ((Component)this).transform.position; Vector3 val = _p1 - _p0; Fx.Launch(pendingMove, position, ((Vector3)(ref val)).normalized, _inWater); Move pendingMove2 = _pendingMove; Vector3 position2 = ((Component)this).transform.position; val = _p1 - _p0; Net.SendAttack(0, pendingMove2, position2, ((Vector3)(ref val)).normalized, 1f, crit: false, _inWater); if (Object.op_Implicit((Object)(object)_trail) && Plugin.AttackEffects.Value) { Color val2 = TypeChart.ColorOf(_pendingMove.Type); _trail.startColor = new Color(val2.r, val2.g, val2.b, 0.9f); _trail.endColor = new Color(val2.r, val2.g, val2.b, 0f); _trail.Clear(); _trail.emitting = true; } } private void DoArc(float dt, bool lunge) { //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_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_006a: 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_009d: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) _arcT += dt / _arcDur; float num = Mathf.Clamp01(_arcT); Vector3 val = Vector3.Lerp(_p0, _p1, num) + Vector3.up * (_arcHeight * 4f * num * (1f - num)); Vector3 val2 = val - ((Component)this).transform.position; ((Component)this).transform.position = val; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { Quaternion val3 = Quaternion.LookRotation(lunge ? val2 : (-val2)); FaceYaw(((Quaternion)(ref val3)).eulerAngles.y, dt * 12f); } if (num < 1f) { return; } if (lunge) { try { if (_pvp) { PvpImpact(); } else { Impact(); } } catch (Exception ex) { if (!_impactErrorLogged) { Plugin.Log.LogError((object)("FishMon attack failed, the game probably updated: " + ex.GetBaseException())); } _impactErrorLogged = true; } if (Object.op_Implicit((Object)(object)_trail)) { _trail.emitting = false; } Vector3 val4 = _p0 - _p1; val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { val4 = -((Component)this).transform.forward; } Vector3 val5 = _p1 + ((Vector3)(ref val4)).normalized * Mathf.Max(3f, _bossRadius * 0.6f + 2f); val5.y = SurfaceY(val5, out var _) + HalfHeight; _p0 = ((Component)this).transform.position; _p1 = val5; _arcDur = 0.55f; _arcHeight = 1.5f; _arcT = 0f; _state = State.Recover; } else { _state = ((_pvp || (_boss != null && !_boss.Dead)) ? State.Engage : State.Follow); float num2 = Mon.CalcStat(5); _attackCooldown = Mathf.Clamp(3.2f - num2 * 0.015f, 0.8f, 3.2f) / Mathf.Max(0.1f, Plugin.AttackSpeedMultiplier.Value) * (0.85f + Combat.Random01() * 0.3f) / SpeedMult / (Mon.Holds(HeldItem.QuickClaw) ? 1.2f : 1f); if (_inWater) { Effects(((Component)this).transform.position, "FishCaught_Splash", splash: true); } } } private void Impact() { //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: 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_002b: 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_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_003f: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_031e: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: 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_03c9: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_00ac: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) if (_boss == null || _boss.Dead || _pendingMove == null) { return; } Vector3 position = ((Component)this).transform.position; Vector3 val = _p1 - _p0; Vector3 normalized = ((Vector3)(ref val)).normalized; List<Creature> list = (_pendingMove.Spread ? SpreadTargets(_boss.Center) : new List<Creature>()); float mult = ((list.Count > 0) ? 0.75f : 1f); if (list.Count > 0) { HitSpread(list, mult, normalized); } if ((int)_boss.Creature.BossType != 0 && BossManager.IsImmortal) { FishMonController.AddFloat(position, "Immune!", Color.gray); return; } HitResult hitResult = Combat.FishHitsBoss(Mon, _boss, _pendingMove, mult); if (hitResult.Missed) { FishMonController.AddFloat(position, "Missed!", Color.gray);