Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of StarPlatinumMod v1.0.0
BepInEx/plugins/StarPlatinumMod/StarPlatinumMod.dll
Decompiled 2 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyVersion("0.0.0.0")] namespace StarPlatinumMod; [BepInPlugin("local.starplatinum", "Star Platinum", "0.2.2")] public class Plugin : BaseUnityPlugin { public const string Guid = "local.starplatinum"; public const string PluginName = "Star Platinum"; public const string PluginVersion = "0.2.2"; internal static ManualLogSource Log; internal static AssetBundle Bundle; private void Awake() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; StarPlatinumConfig.Bind(((BaseUnityPlugin)this).Config); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "starplatinum"); if (!File.Exists(text)) { Log.LogError((object)("Не найден AssetBundle: " + text + " (положите файл 'starplatinum' рядом с DLL).")); return; } Bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)Bundle == (Object)null) { Log.LogError((object)"Не удалось загрузить AssetBundle (проверьте версию Unity при сборке)."); return; } StarPlatinumAssets.Load(Bundle); new Harmony("local.starplatinum").PatchAll(Assembly.GetExecutingAssembly()); GameObject val = new GameObject("StarPlatinumManager") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)val); val.AddComponent<StarPlatinumController>(); Log.LogInfo((object)"Star Platinum 0.2.2 загружен."); } } public static class StarPlatinumConfig { public static ConfigEntry<Key> SummonKey; public static ConfigEntry<Key> TimeStopKey; public static ConfigEntry<Key> TauntKey; public static ConfigEntry<float> ShovelForceFallback; public static ConfigEntry<float> SingleMultiplier; public static ConfigEntry<float> BarrageMultiplier; public static ConfigEntry<float> SingleCooldown; public static ConfigEntry<float> SingleHitDelay; public static ConfigEntry<float> BarrageMaxDuration; public static ConfigEntry<float> BarrageCooldown; public static ConfigEntry<float> BarrageTickInterval; public static ConfigEntry<float> TimeStopDuration; public static ConfigEntry<float> TimeStopCooldown; public static ConfigEntry<float> HitRange; public static ConfigEntry<float> HitRadius; public static ConfigEntry<float> Volume; public static ConfigEntry<float> StandScale; public static ConfigEntry<bool> HitPlayers; public static ConfigEntry<bool> UseDissolve; public static ConfigEntry<int> ShopPrice; public static ConfigEntry<bool> RequirePurchase; public static ConfigEntry<string> ShopCommand; public static void Bind(ConfigFile c) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Invalid comparison between Unknown and I4 SummonKey = c.Bind<Key>("Controls", "SummonKey", (Key)20, "Призвать / убрать стенд"); TimeStopKey = c.Bind<Key>("Controls", "TimeStopKey", (Key)17, "Остановка времени"); TauntKey = c.Bind<Key>("Controls", "TauntKey", (Key)34, "Случайный таунт (один из двух звуков)"); ConfigEntry<bool> val = c.Bind<bool>("Internal", "ControlsAndTimeStopV2Migrated", false, "Служебный флаг миграции настроек Star Platinum."); if (!val.Value) { if ((int)TimeStopKey.Value == 22) { TimeStopKey.Value = (Key)17; } if ((int)TauntKey.Value == 39) { TauntKey.Value = (Key)34; } val.Value = true; } ShovelForceFallback = c.Bind<float>("Damage", "ShovelForceFallback", 1f, "Сила одного удара лопатой. Плагин пытается прочитать её из игры, это значение используется только если не вышло."); SingleMultiplier = c.Bind<float>("Damage", "SingleMultiplier", 2f, "Одиночный удар = N ударов лопатой"); BarrageMultiplier = c.Bind<float>("Damage", "BarrageMultiplier", 0.5f, "Один удар серии = N ударов лопатой"); SingleCooldown = c.Bind<float>("Damage", "SingleCooldown", 5f, "Перезарядка одиночного удара, сек"); SingleHitDelay = c.Bind<float>("Damage", "SingleHitDelay", 0.2f, "Задержка попадания после начала анимации, сек"); HitPlayers = c.Bind<bool>("Damage", "HitPlayers", false, "Бить других игроков"); RequirePurchase = c.Bind<bool>("Shop", "RequirePurchase", true, "true: стенд нужно купить в терминале, после смерти он пропадает. false: стенд доступен всегда (для тестов)."); ShopPrice = c.Bind<int>("Shop", "Price", 1000, "Цена стенда в кредитах группы"); ShopCommand = c.Bind<string>("Shop", "Command", "star platinum", "Команда терминала для покупки"); BarrageMaxDuration = c.Bind<float>("Barrage", "MaxDuration", 6f, "Макс. длительность серии, сек"); BarrageCooldown = c.Bind<float>("Barrage", "Cooldown", 2f, "Перезарядка после серии, сек"); BarrageTickInterval = c.Bind<float>("Barrage", "TickInterval", 0.12f, "Интервал между ударами серии, сек"); TimeStopDuration = c.Bind<float>("TimeStop", "Duration", 9f, "Длительность остановки времени, сек"); ConfigEntry<bool> val2 = c.Bind<bool>("Internal", "TimeStopDurationV2Migrated", false, "Служебный флаг миграции длительности остановки времени."); if (!val2.Value) { if (Mathf.Abs(TimeStopDuration.Value - 5f) < 0.001f) { TimeStopDuration.Value = 9f; } val2.Value = true; } TimeStopCooldown = c.Bind<float>("TimeStop", "Cooldown", 20f, "Перезарядка после окончания, сек"); HitRange = c.Bind<float>("Stand", "HitRange", 2.2f, "Дальность удара, м"); HitRadius = c.Bind<float>("Stand", "HitRadius", 1.5f, "Радиус зоны попадания, м"); Volume = c.Bind<float>("Stand", "Volume", 0.8f, "Громкость звуков"); StandScale = c.Bind<float>("Stand", "Scale", 1f, "Дополнительный множитель масштаба стенда; базовый размер равен 2x от исходного."); UseDissolve = c.Bind<bool>("Stand", "UseDissolve", true, "Растворение через alpha-clip. Если материал стенда выглядит сломанным (розовый/чёрный), поставьте false: тогда он будет сжиматься."); } } public static class StarPlatinumAssets { public static GameObject Prefab; public static Texture2D BaseA; public static Texture2D NormalA; public static Texture2D BaseB; public static AudioClip TimeStop; public static AudioClip Taunt; public static AudioClip Taunt2; public static AudioClip Punch; public static AudioClip Barrage; public static AudioClip Resume; public static void Load(AssetBundle b) { Prefab = b.LoadAsset<GameObject>("StarPlatinum"); BaseA = b.LoadAsset<Texture2D>("sp_base_A"); NormalA = b.LoadAsset<Texture2D>("sp_normal_A"); BaseB = b.LoadAsset<Texture2D>("sp_base_B"); TimeStop = b.LoadAsset<AudioClip>("sp_timestop"); Taunt = b.LoadAsset<AudioClip>("sp_taunt"); Taunt2 = b.LoadAsset<AudioClip>("sp_taunt2"); Punch = b.LoadAsset<AudioClip>("sp_punch"); Barrage = b.LoadAsset<AudioClip>("sp_barrage"); Resume = b.LoadAsset<AudioClip>("sp_resume"); if ((Object)(object)Prefab == (Object)null) { Plugin.Log.LogError((object)"В бандле нет префаба StarPlatinum."); } if ((Object)(object)BaseA == (Object)null || (Object)(object)NormalA == (Object)null || (Object)(object)BaseB == (Object)null) { Plugin.Log.LogWarning((object)"В бандле не хватает текстур."); } if ((Object)(object)TimeStop == (Object)null || (Object)(object)Taunt == (Object)null || (Object)(object)Taunt2 == (Object)null || (Object)(object)Punch == (Object)null || (Object)(object)Barrage == (Object)null || (Object)(object)Resume == (Object)null) { Plugin.Log.LogWarning((object)"В бандле не хватает звуков (ожидаются sp_timestop, sp_taunt, sp_taunt2, sp_punch, sp_barrage, sp_resume)."); } Plugin.Log.LogInfo((object)("Audio loaded: TimeStop=" + Describe(TimeStop) + "; Taunt1=" + Describe(Taunt) + "; Taunt2=" + Describe(Taunt2))); } private static string Describe(AudioClip clip) { if (!((Object)(object)clip == (Object)null)) { return ((Object)clip).name + " (" + clip.length.ToString("0.00") + " sec)"; } return "MISSING"; } } public static class StarPlatinumCombat { private static float cachedShovelForce; public static float ShovelForce() { if (cachedShovelForce > 0f) { return cachedShovelForce; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.allItemsList != (Object)null && instance.allItemsList.itemsList != null) { foreach (Item items in instance.allItemsList.itemsList) { if (!((Object)(object)items == (Object)null) && !((Object)(object)items.spawnPrefab == (Object)null)) { Shovel component = items.spawnPrefab.GetComponent<Shovel>(); if ((Object)(object)component != (Object)null && component.shovelHitForce > 0) { cachedShovelForce = component.shovelHitForce; Plugin.Log.LogInfo((object)("Сила удара лопатой из игры: " + cachedShovelForce)); return cachedShovelForce; } } } } return StarPlatinumConfig.ShovelForceFallback.Value; } public static float GetAimPitch(PlayerControllerB owner) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner == (Object)null || (Object)(object)owner.gameplayCamera == (Object)null) { return 0f; } return Mathf.Clamp(Mathf.DeltaAngle(0f, ((Component)owner.gameplayCamera).transform.eulerAngles.x), -85f, 85f); } private static Ray GetAimRay(PlayerControllerB owner, StarPlatinumStand stand) { //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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner != (Object)null && (Object)(object)owner.gameplayCamera != (Object)null) { return owner.gameplayCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); } return new Ray(((Component)stand).transform.position + Vector3.up * 1.2f, ((Component)stand).transform.forward); } public static bool Strike(PlayerControllerB owner, StarPlatinumStand stand, float multiplier, Dictionary<object, float> acc) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_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_01aa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner == (Object)null || (Object)(object)stand == (Object)null) { return false; } Ray aimRay = GetAimRay(owner, stand); Vector3 direction = ((Ray)(ref aimRay)).direction; Vector3 normalized = ((Vector3)(ref direction)).normalized; float num = Mathf.Max(0.5f, StarPlatinumConfig.HitRange.Value + StarPlatinumConfig.HitRadius.Value); Vector3 val = ((Ray)(ref aimRay)).origin + normalized * num; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(aimRay, ref val2, num, -1, (QueryTriggerInteraction)2) && (Object)(object)(((Object)(object)((RaycastHit)(ref val2)).collider != (Object)null) ? ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<PlayerControllerB>() : null) != (Object)(object)owner) { val = ((RaycastHit)(ref val2)).point; } Collider[] array = Physics.OverlapSphere(val, StarPlatinumConfig.HitRadius.Value, -1, (QueryTriggerInteraction)2); float num2 = ShovelForce() * multiplier; HashSet<object> hashSet = new HashSet<object>(); bool result = false; Collider[] array2 = array; foreach (Collider val3 in array2) { if ((Object)(object)val3 == (Object)null) { continue; } EnemyAICollisionDetect component = ((Component)val3).GetComponent<EnemyAICollisionDetect>(); object obj; IHittable val4; if ((Object)(object)component != (Object)null && (Object)(object)component.mainScript != (Object)null) { if (component.mainScript.isEnemyDead) { continue; } obj = component.mainScript; val4 = (IHittable)(object)component; } else { if (!StarPlatinumConfig.HitPlayers.Value) { continue; } PlayerControllerB componentInParent = ((Component)val3).GetComponentInParent<PlayerControllerB>(); if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent == (Object)(object)owner || !componentInParent.isPlayerControlled || componentInParent.isPlayerDead) { continue; } obj = componentInParent; val4 = (IHittable)(object)componentInParent; } if (hashSet.Add(obj)) { acc.TryGetValue(obj, out var value); value += num2; int num3 = Mathf.FloorToInt(value + 0.0001f); acc[obj] = value - (float)num3; if (num3 > 0) { val4.Hit(num3, normalized, owner, true, 1); result = true; } } } return result; } } public class StarPlatinumController : MonoBehaviour { private class Frozen { public bool wasEnabled; public float animSpeed; public bool agentStopped; public List<AudioSource> paused = new List<AudioSource>(); } public static StarPlatinumController Instance; private readonly Dictionary<int, StarPlatinumStand> stands = new Dictionary<int, StarPlatinumStand>(); private AudioSource globalSrc; private GameObject overlay; private float nextRegisterTry; private float nextSingleAt; private float barrageReadyAt; private float tsReadyAt; private bool nextHandRight = true; private bool barrageActive; private float barrageStart; private float barrageNextTick; private readonly Dictionary<object, float> barrageAcc = new Dictionary<object, float>(); private bool tsActive; private float tsEnd; private readonly Dictionary<EnemyAI, Frozen> frozen = new Dictionary<EnemyAI, Frozen>(); public static bool LocalStandSummoned { get { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance.LocalStand != (Object)null) { return Instance.LocalStand.IsSummoned; } return false; } } public static bool TimeStopActive { get { if ((Object)(object)Instance != (Object)null) { return Instance.tsActive; } return false; } } private StarPlatinumStand LocalStand { get { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.localPlayerController == (Object)null) { return null; } stands.TryGetValue(Idx(instance.localPlayerController), out var value); return value; } } private static int Idx(PlayerControllerB p) { return (int)p.playerClientId; } private void Awake() { Instance = this; globalSrc = ((Component)this).gameObject.AddComponent<AudioSource>(); globalSrc.spatialBlend = 0f; globalSrc.playOnAwake = false; } private void Update() { StartOfRound instance = StartOfRound.Instance; NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)instance == (Object)null || (Object)(object)singleton == (Object)null || !singleton.IsListening) { if (stands.Count > 0) { ClearAll(); } if (tsActive) { EndTimeStop(silent: true); } StarPlatinumNetwork.Reset(); StarPlatinumShop.Reset(); } else { if (!StarPlatinumNetwork.IsRegistered && Time.time >= nextRegisterTry) { nextRegisterTry = Time.time + 1f; StarPlatinumNetwork.Register(); } CleanupStands(instance); TimeStopTick(); HandleLocalInput(instance); } } private void CleanupStands(StartOfRound sor) { List<int> list = null; foreach (KeyValuePair<int, StarPlatinumStand> stand in stands) { StarPlatinumStand value = stand.Value; if (!((Object)(object)value == (Object)null) && !((Object)(object)value.Owner == (Object)null) && value.Owner.isPlayerControlled && !value.Owner.isPlayerDead) { continue; } if ((Object)(object)value != (Object)null && value.IsSummoned) { value.Dismiss(); } if ((Object)(object)value == (Object)null || (Object)(object)value.Owner == (Object)null || !value.Owner.isPlayerControlled) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } (list ?? (list = new List<int>())).Add(stand.Key); } } if (list == null) { return; } foreach (int item in list) { stands.Remove(item); } } private void ClearAll() { foreach (StarPlatinumStand value in stands.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } } stands.Clear(); barrageActive = false; } private StarPlatinumStand GetOrCreate(PlayerControllerB p) { int key = Idx(p); if (stands.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } value = StarPlatinumStand.Create(p); if ((Object)(object)value != (Object)null) { stands[key] = value; } return value; } private static bool InputBlocked(PlayerControllerB lp) { if (!lp.isTypingChat && !lp.inTerminalMenu && !lp.isFreeCamera) { if ((Object)(object)lp.quickMenuManager != (Object)null) { return lp.quickMenuManager.isMenuOpen; } return false; } return true; } private void HandleLocalInput(StartOfRound sor) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = sor.localPlayerController; StarPlatinumStand localStand = LocalStand; if ((Object)(object)localPlayerController != (Object)null && localPlayerController.isPlayerDead) { LoseStand(localPlayerController, localStand); return; } if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerControlled) { if (barrageActive) { StopBarrage(); } return; } if (InputBlocked(localPlayerController)) { if (barrageActive) { StopBarrage(); } return; } Keyboard current = Keyboard.current; Mouse current2 = Mouse.current; if (current == null || current2 == null) { return; } if (((ButtonControl)current[StarPlatinumConfig.SummonKey.Value]).wasPressedThisFrame) { ToggleSummon(localPlayerController, localStand); } localStand = LocalStand; if ((Object)(object)localStand == (Object)null || !localStand.IsSummoned) { if (barrageActive) { StopBarrage(); } return; } if (((ButtonControl)current[StarPlatinumConfig.TauntKey.Value]).wasPressedThisFrame) { int num = Random.Range(0, 2); Plugin.Log.LogInfo((object)("Выбран таунт: " + ((num == 1) ? "sp_taunt2 (второй MP3)" : "sp_taunt (первый MP3)"))); localStand.PlayTaunt(num); StarPlatinumNetwork.Send(SpMsg.Taunt, Idx(localPlayerController), num); } if (((ButtonControl)current[StarPlatinumConfig.TimeStopKey.Value]).wasPressedThisFrame) { TryTimeStop(localPlayerController); } if (current2.rightButton.wasPressedThisFrame) { TrySinglePunch(localPlayerController, localStand); } if (current2.leftButton.isPressed) { TryBarrage(localPlayerController, localStand); } else if (barrageActive) { StopBarrage(); } if (barrageActive) { if (Time.time - barrageStart >= StarPlatinumConfig.BarrageMaxDuration.Value) { StopBarrage(); } else if (Time.time >= barrageNextTick) { barrageNextTick = Time.time + StarPlatinumConfig.BarrageTickInterval.Value; StarPlatinumCombat.Strike(localPlayerController, localStand, StarPlatinumConfig.BarrageMultiplier.Value, barrageAcc); } } } private void LoseStand(PlayerControllerB lp, StarPlatinumStand stand) { if (barrageActive) { StopBarrage(); } if ((Object)(object)stand != (Object)null && stand.IsSummoned) { stand.Dismiss(); StarPlatinumNetwork.Send(SpMsg.Dismiss, Idx(lp), 0f); } if (StarPlatinumShop.Owned && StarPlatinumConfig.RequirePurchase.Value) { StarPlatinumShop.Owned = false; Plugin.Log.LogInfo((object)"Игрок умер: стенд потерян."); } } private void ToggleSummon(PlayerControllerB lp, StarPlatinumStand stand) { if ((Object)(object)stand != (Object)null && stand.IsSummoned) { StopBarrage(); stand.Dismiss(); StarPlatinumNetwork.Send(SpMsg.Dismiss, Idx(lp), 0f); return; } if (!StarPlatinumShop.CanUse) { StarPlatinumShop.ShowHint(); return; } StarPlatinumStand orCreate = GetOrCreate(lp); if (!((Object)(object)orCreate == (Object)null)) { orCreate.Summon(instant: false); StarPlatinumNetwork.Send(SpMsg.Summon, Idx(lp), 0f); } } private void TrySinglePunch(PlayerControllerB lp, StarPlatinumStand stand) { if (!(Time.time < nextSingleAt)) { nextSingleAt = Time.time + StarPlatinumConfig.SingleCooldown.Value; bool flag = nextHandRight; nextHandRight = !nextHandRight; float aimPitch = StarPlatinumCombat.GetAimPitch(lp); stand.Punch(flag, aimPitch); StarPlatinumNetwork.Send(flag ? SpMsg.PunchR : SpMsg.PunchL, Idx(lp), aimPitch + 90f); ((MonoBehaviour)this).StartCoroutine(HitAfter(StarPlatinumConfig.SingleHitDelay.Value, stand, StarPlatinumConfig.SingleMultiplier.Value)); } } private IEnumerator HitAfter(float delay, StarPlatinumStand stand, float multiplier) { yield return (object)new WaitForSeconds(delay); StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)stand == (Object)null) && stand.IsSummoned && !((Object)(object)instance == (Object)null) && !((Object)(object)instance.localPlayerController == (Object)null)) { StarPlatinumCombat.Strike(instance.localPlayerController, stand, multiplier, new Dictionary<object, float>()); } } private void TryBarrage(PlayerControllerB lp, StarPlatinumStand stand) { if (!barrageActive && !(Time.time < barrageReadyAt)) { barrageActive = true; barrageStart = Time.time; barrageNextTick = Time.time + 0.15f; barrageAcc.Clear(); float aimPitch = StarPlatinumCombat.GetAimPitch(lp); stand.StartBarrage(aimPitch); StarPlatinumNetwork.Send(SpMsg.BarrageStart, Idx(lp), aimPitch + 90f); } } private void StopBarrage() { if (barrageActive) { barrageActive = false; barrageReadyAt = Time.time + StarPlatinumConfig.BarrageCooldown.Value; barrageAcc.Clear(); StartOfRound instance = StartOfRound.Instance; StarPlatinumStand localStand = LocalStand; if ((Object)(object)localStand != (Object)null) { localStand.StopBarrage(); } if ((Object)(object)instance != (Object)null && (Object)(object)instance.localPlayerController != (Object)null) { StarPlatinumNetwork.Send(SpMsg.BarrageStop, Idx(instance.localPlayerController), 0f); } } } private void TryTimeStop(PlayerControllerB lp) { if (!tsActive && !(Time.time < tsReadyAt)) { float value = StarPlatinumConfig.TimeStopDuration.Value; tsReadyAt = Time.time + value + StarPlatinumConfig.TimeStopCooldown.Value; BeginTimeStop(Idx(lp), value); StarPlatinumNetwork.Send(SpMsg.TimeStopStart, Idx(lp), value); } } public void OnRemote(SpMsg kind, int p, float arg) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || p < 0 || p >= instance.allPlayerScripts.Length) { return; } PlayerControllerB val = instance.allPlayerScripts[p]; if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)instance.localPlayerController) { return; } stands.TryGetValue(p, out var value); switch (kind) { case SpMsg.Summon: value = GetOrCreate(val); if ((Object)(object)value != (Object)null) { value.Summon(arg > 0.5f); } break; case SpMsg.Dismiss: if ((Object)(object)value != (Object)null) { value.Dismiss(); } break; case SpMsg.PunchR: if ((Object)(object)value != (Object)null) { value.Punch(right: true, arg - 90f); } break; case SpMsg.PunchL: if ((Object)(object)value != (Object)null) { value.Punch(right: false, arg - 90f); } break; case SpMsg.BarrageStart: if ((Object)(object)value != (Object)null) { value.StartBarrage(arg - 90f); } break; case SpMsg.BarrageStop: if ((Object)(object)value != (Object)null) { value.StopBarrage(); } break; case SpMsg.Taunt: if ((Object)(object)value != (Object)null) { value.PlayTaunt((arg >= 0.5f) ? 1 : 0); } break; case SpMsg.TimeStopStart: if (!tsActive) { BeginTimeStop(p, arg); } break; } } private void BeginTimeStop(int ownerIdx, float duration) { tsActive = true; tsEnd = Time.time + duration; if (stands.TryGetValue(ownerIdx, out var value) && (Object)(object)value != (Object)null) { value.CastTimeStop(); } Play2D(StarPlatinumAssets.TimeStop); SetOverlay(on: true); FreezeEnemies(); } private void TimeStopTick() { if (tsActive) { FreezeEnemies(); if (Time.time >= tsEnd) { EndTimeStop(silent: false); } } } private void EndTimeStop(bool silent) { if (!tsActive) { return; } tsActive = false; foreach (KeyValuePair<EnemyAI, Frozen> item in new List<KeyValuePair<EnemyAI, Frozen>>(frozen)) { Unfreeze(item.Key, item.Value); } frozen.Clear(); SetOverlay(on: false); if (!silent) { Play2D(StarPlatinumAssets.Resume); } } private void FreezeEnemies() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) RoundManager instance = RoundManager.Instance; if ((Object)(object)instance == (Object)null || instance.SpawnedEnemies == null) { return; } for (int i = 0; i < instance.SpawnedEnemies.Count; i++) { EnemyAI val = instance.SpawnedEnemies[i]; if ((Object)(object)val == (Object)null || val.isEnemyDead || this.frozen.ContainsKey(val)) { continue; } Frozen frozen = new Frozen { wasEnabled = ((Behaviour)val).enabled }; if ((Object)(object)val.creatureAnimator != (Object)null) { frozen.animSpeed = val.creatureAnimator.speed; val.creatureAnimator.speed = 0f; } if ((Object)(object)val.agent != (Object)null && ((Behaviour)val.agent).enabled && val.agent.isOnNavMesh) { frozen.agentStopped = val.agent.isStopped; val.agent.isStopped = true; val.agent.velocity = Vector3.zero; } AudioSource[] array = (AudioSource[])(object)new AudioSource[2] { val.creatureVoice, val.creatureSFX }; foreach (AudioSource val2 in array) { if ((Object)(object)val2 != (Object)null && val2.isPlaying) { val2.Pause(); frozen.paused.Add(val2); } } ((Behaviour)val).enabled = false; this.frozen[val] = frozen; } } private void Unfreeze(EnemyAI e, Frozen f) { if ((Object)(object)e == (Object)null) { return; } ((Behaviour)e).enabled = f.wasEnabled; if ((Object)(object)e.creatureAnimator != (Object)null) { e.creatureAnimator.speed = f.animSpeed; } if ((Object)(object)e.agent != (Object)null && ((Behaviour)e.agent).enabled && e.agent.isOnNavMesh) { e.agent.isStopped = f.agentStopped; } foreach (AudioSource item in f.paused) { if ((Object)(object)item != (Object)null) { item.UnPause(); } } } private void Play2D(AudioClip c) { if (!((Object)(object)c == (Object)null)) { globalSrc.PlayOneShot(c, StarPlatinumConfig.Volume.Value); } } private void SetOverlay(bool on) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)overlay == (Object)null) { overlay = new GameObject("SP_TimeStopOverlay"); Object.DontDestroyOnLoad((Object)(object)overlay); Canvas obj = overlay.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 50; GameObject val = new GameObject("Tint", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(overlay.transform, false); RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; Image obj2 = val.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0.45f, 0.3f, 0.8f, 0.18f); ((Graphic)obj2).raycastTarget = false; } overlay.SetActive(on); } } public enum SpMsg : byte { Summon, Dismiss, PunchR, PunchL, BarrageStart, BarrageStop, TimeStopStart, Taunt, RequestState } public static class StarPlatinumNetwork { private const string MsgName = "StarPlatinum.Msg"; private static NetworkManager registeredOn; private static readonly HashSet<int> serverSummoned = new HashSet<int>(); private static int serverTsOwner = -1; private static float serverTsEnd; public static bool IsRegistered => (Object)(object)registeredOn != (Object)null; public static void Register() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)singleton == (Object)null) && singleton.IsListening && singleton.CustomMessagingManager != null && !((Object)(object)instance == (Object)null) && !((Object)(object)instance.localPlayerController == (Object)null) && !((Object)(object)registeredOn == (Object)(object)singleton)) { singleton.CustomMessagingManager.RegisterNamedMessageHandler("StarPlatinum.Msg", new HandleNamedMessageDelegate(OnMessage)); registeredOn = singleton; serverSummoned.Clear(); serverTsOwner = -1; Plugin.Log.LogInfo((object)("Сетевой обработчик зарегистрирован (server=" + singleton.IsServer + ").")); if (!singleton.IsServer) { Send(SpMsg.RequestState, (int)instance.localPlayerController.playerClientId, 0f); } } } public static void Reset() { registeredOn = null; serverSummoned.Clear(); serverTsOwner = -1; } public static void Send(SpMsg kind, int player, float arg) { NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton == (Object)null) && singleton.IsListening && singleton.CustomMessagingManager != null) { if (singleton.IsServer) { ServerTrack(kind, player, arg); Broadcast(singleton, kind, player, arg, singleton.LocalClientId); } else { SendTo(singleton, 0uL, kind, player, arg); } } } private static void Broadcast(NetworkManager nm, SpMsg kind, int player, float arg, ulong skipClient) { foreach (ulong connectedClientsId in nm.ConnectedClientsIds) { if (connectedClientsId != 0L && connectedClientsId != skipClient) { SendTo(nm, connectedClientsId, kind, player, arg); } } } private unsafe static void SendTo(NetworkManager nm, ulong clientId, SpMsg kind, int player, float arg) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) ushort num = (ushort)Mathf.Clamp(Mathf.RoundToInt(arg * 10f), 0, 65535); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteByteSafe((byte)kind); ((FastBufferWriter)(ref val)).WriteByteSafe((byte)player); ((FastBufferWriter)(ref val)).WriteByteSafe((byte)(num >> 8)); ((FastBufferWriter)(ref val)).WriteByteSafe((byte)(num & 0xFF)); nm.CustomMessagingManager.SendNamedMessage("StarPlatinum.Msg", clientId, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private static void OnMessage(ulong senderClientId, FastBufferReader reader) { byte b = default(byte); ((FastBufferReader)(ref reader)).ReadByteSafe(ref b); byte b2 = default(byte); ((FastBufferReader)(ref reader)).ReadByteSafe(ref b2); byte b3 = default(byte); ((FastBufferReader)(ref reader)).ReadByteSafe(ref b3); byte b4 = default(byte); ((FastBufferReader)(ref reader)).ReadByteSafe(ref b4); SpMsg spMsg = (SpMsg)b; float arg = (float)((b3 << 8) | b4) / 10f; NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null) { return; } if (singleton.IsServer) { if (spMsg == SpMsg.RequestState) { SendState(singleton, senderClientId); return; } ServerTrack(spMsg, b2, arg); Broadcast(singleton, spMsg, b2, arg, senderClientId); } if (spMsg != SpMsg.RequestState && (Object)(object)StarPlatinumController.Instance != (Object)null) { StarPlatinumController.Instance.OnRemote(spMsg, b2, arg); } } private static void ServerTrack(SpMsg kind, int player, float arg) { switch (kind) { case SpMsg.Summon: serverSummoned.Add(player); break; case SpMsg.Dismiss: serverSummoned.Remove(player); break; case SpMsg.TimeStopStart: serverTsOwner = player; serverTsEnd = Time.time + arg; break; } } private static void SendState(NetworkManager nm, ulong client) { foreach (int item in serverSummoned) { SendTo(nm, client, SpMsg.Summon, item, 1f); } if (serverTsOwner >= 0 && serverTsEnd > Time.time) { SendTo(nm, client, SpMsg.TimeStopStart, serverTsOwner, serverTsEnd - Time.time); } } } [HarmonyPatch(typeof(PlayerControllerB), "ActivateItem_performed")] internal static class BlockItemUsePatch { private static bool Prefix() { return !StarPlatinumController.LocalStandSummoned; } } [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] internal static class BlockScanPatch { private static bool Prefix() { return !StarPlatinumController.LocalStandSummoned; } } [HarmonyPatch(typeof(TimeOfDay), "MoveTimeOfDay")] internal static class FreezeDayTimePatch { private static bool Prefix() { return !StarPlatinumController.TimeStopActive; } } [HarmonyPatch(typeof(TimeOfDay), "MoveGlobalTime")] internal static class FreezeGlobalTimePatch { private static bool Prefix() { return !StarPlatinumController.TimeStopActive; } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] internal static class RegisterNetworkPatch { private static void Postfix() { StarPlatinumNetwork.Register(); } } public static class StarPlatinumShop { public static bool Owned; internal static bool PendingConfirm; private static float nextHintAt; public static bool CanUse { get { if (StarPlatinumConfig.RequirePurchase.Value) { return Owned; } return true; } } public static void Reset() { Owned = false; PendingConfirm = false; } public static void ShowHint() { if (!(Time.time < nextHintAt)) { nextHintAt = Time.time + 4f; if (!((Object)(object)HUDManager.Instance == (Object)null)) { HUDManager.Instance.DisplayTip("Star Platinum", "Buy the stand at the ship terminal: type " + Cmd().ToUpperInvariant() + " (" + StarPlatinumConfig.ShopPrice.Value + " credits).", false, false, "SP_ShopHint"); } } } internal static string Cmd() { string value = StarPlatinumConfig.ShopCommand.Value; if (!string.IsNullOrWhiteSpace(value)) { return value.Trim().ToLowerInvariant(); } return "star platinum"; } internal static string ReadInput(Terminal t) { if ((Object)(object)t == (Object)null || (Object)(object)t.screenText == (Object)null) { return ""; } string text = t.screenText.text; int textAdded = t.textAdded; if (string.IsNullOrEmpty(text) || textAdded <= 0 || textAdded > text.Length) { return ""; } return text.Substring(text.Length - textAdded).Trim().ToLowerInvariant(); } internal static TerminalNode MakeNode(string text) { TerminalNode obj = ScriptableObject.CreateInstance<TerminalNode>(); obj.displayText = text; obj.clearPreviousText = true; return obj; } internal static bool IsCommand(string input) { string text = Cmd(); if (!(input == text)) { return input.Replace(" ", "") == text.Replace(" ", ""); } return true; } internal static TerminalNode InfoNode(Terminal t) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!StarPlatinumConfig.RequirePurchase.Value) { return MakeNode("STAR PLATINUM\n\nThe stand is free in this configuration.\nPress " + ((object)StarPlatinumConfig.SummonKey.Value/*cast due to .constrained prefix*/).ToString() + " to summon it.\n\n"); } if (Owned) { return MakeNode("STAR PLATINUM\n\nYou already own the stand.\nPress " + ((object)StarPlatinumConfig.SummonKey.Value/*cast due to .constrained prefix*/).ToString() + " to summon it.\nIt is lost when you die.\n\n"); } PendingConfirm = true; return MakeNode("STAR PLATINUM STAND\n\nA spirit that fights beside you.\nPrice: " + StarPlatinumConfig.ShopPrice.Value + " credits (group credits: " + t.groupCredits + ")\nYou lose it when you die.\n\nType CONFIRM to buy or DENY to cancel.\n\n"); } internal static TerminalNode BuyNode(Terminal t) { //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) int value = StarPlatinumConfig.ShopPrice.Value; if (Owned) { return MakeNode("You already own the stand.\n\n"); } if (t.groupCredits < value) { return MakeNode("Not enough credits.\nPrice: " + value + " You have: " + t.groupCredits + "\n\n"); } t.groupCredits -= value; t.SyncGroupCreditsServerRpc(t.groupCredits, t.numberOfItemsInDropship); Owned = true; Plugin.Log.LogInfo((object)("Стенд куплен за " + value + " кредитов.")); return MakeNode("Purchase complete.\nPress " + ((object)StarPlatinumConfig.SummonKey.Value/*cast due to .constrained prefix*/).ToString() + " to summon Star Platinum.\nCredits left: " + t.groupCredits + "\n\n"); } } [HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")] internal static class TerminalParsePatch { [HarmonyPrefix] private static bool Prefix(Terminal __instance, ref TerminalNode __result) { string text = StarPlatinumShop.ReadInput(__instance); if (StarPlatinumShop.PendingConfirm) { StarPlatinumShop.PendingConfirm = false; switch (text) { case "confirm": case "c": __result = StarPlatinumShop.BuyNode(__instance); return false; case "deny": case "d": __result = StarPlatinumShop.MakeNode("Purchase cancelled.\n\n"); return false; } } if (text.Length > 0 && StarPlatinumShop.IsCommand(text)) { __result = StarPlatinumShop.InfoNode(__instance); return false; } return true; } [HarmonyPostfix] private static void Postfix(Terminal __instance, TerminalNode __result) { if (!((Object)(object)__result == (Object)null) && __result.displayText != null && !(StarPlatinumShop.ReadInput(__instance) != "store") && !__result.displayText.Contains("STAR PLATINUM")) { __result.displayText = __result.displayText + "\n* STAR PLATINUM STAND // Price: " + StarPlatinumConfig.ShopPrice.Value + " credits (type " + StarPlatinumShop.Cmd().ToUpperInvariant() + ")\n"; } } } public class StarPlatinumStand : MonoBehaviour { private const float BaseScaleMultiplier = 2f; private GameObject model; private Animator anim; private AudioSource sfx; private AudioSource loop; private readonly List<Material> mats = new List<Material>(); private float dissolve = 1f; private float dissolveTarget = 1f; private float attackUntil; private float attackPitch; private bool barrage; private float bob; private Vector3 vel; public PlayerControllerB Owner { get; private set; } public bool IsLocal { get; private set; } public bool IsSummoned { get; private set; } public static StarPlatinumStand Create(PlayerControllerB owner) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StarPlatinumAssets.Prefab == (Object)null) { return null; } StarPlatinumStand starPlatinumStand = new GameObject("StarPlatinum_" + owner.playerClientId).AddComponent<StarPlatinumStand>(); starPlatinumStand.Init(owner); return starPlatinumStand; } private void Init(PlayerControllerB owner) { //IL_004e: 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_0078: 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) Owner = owner; IsLocal = (Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)owner == (Object)(object)StartOfRound.Instance.localPlayerController; model = Object.Instantiate<GameObject>(StarPlatinumAssets.Prefab, ((Component)this).transform); model.transform.localPosition = Vector3.zero; model.transform.localRotation = Quaternion.identity; model.transform.localScale = Vector3.one * (StarPlatinumConfig.StandScale.Value * 2f); anim = model.GetComponentInChildren<Animator>(); sfx = MakeSource(looped: false); loop = MakeSource(looped: true); loop.clip = StarPlatinumAssets.Barrage; BuildMaterials(); model.SetActive(false); } private AudioSource MakeSource(bool looped) { AudioSource obj = ((Component)this).gameObject.AddComponent<AudioSource>(); obj.playOnAwake = false; obj.loop = looped; obj.spatialBlend = 1f; obj.minDistance = 4f; obj.maxDistance = 45f; obj.rolloffMode = (AudioRolloffMode)1; obj.volume = StarPlatinumConfig.Volume.Value; return obj; } private void BuildMaterials() { Shader val = Shader.Find("HDRP/Lit"); if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)"Шейдер HDRP/Lit не найден, стенд будет без текстур."); return; } Material val2 = MakeMat(val, (Texture)(object)StarPlatinumAssets.BaseA, (Texture)(object)StarPlatinumAssets.NormalA, null); Material val3 = MakeMat(val, (Texture)(object)StarPlatinumAssets.BaseB, null, (Texture)(object)StarPlatinumAssets.BaseB); Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in componentsInChildren) { Material val5 = (((Object)val4).name.Contains("Object_5") ? val3 : val2); Material[] array = (Material[])(object)new Material[Mathf.Max(1, val4.sharedMaterials.Length)]; for (int j = 0; j < array.Length; j++) { array[j] = val5; } val4.sharedMaterials = array; SkinnedMeshRenderer val6 = (SkinnedMeshRenderer)(object)((val4 is SkinnedMeshRenderer) ? val4 : null); if (val6 != null) { val6.updateWhenOffscreen = true; } } } private Material MakeMat(Shader lit, Texture baseMap, Texture normal, Texture emissive) { //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_0012: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(lit) { name = "SP_Material" }; if ((Object)(object)baseMap != (Object)null) { val.SetTexture("_BaseColorMap", baseMap); } val.SetColor("_BaseColor", Color.white); val.SetFloat("_Metallic", 0f); val.SetFloat("_Smoothness", 0.35f); if ((Object)(object)normal != (Object)null) { val.SetTexture("_NormalMap", normal); val.SetFloat("_NormalScale", 1f); val.EnableKeyword("_NORMALMAP"); } if ((Object)(object)emissive != (Object)null) { val.SetTexture("_EmissiveColorMap", emissive); val.SetColor("_EmissiveColor", Color.white * 4f); val.EnableKeyword("_EMISSIVE_COLOR_MAP"); } if (StarPlatinumConfig.UseDissolve.Value) { val.SetFloat("_AlphaCutoffEnable", 1f); val.SetFloat("_AlphaCutoff", 0f); val.EnableKeyword("_ALPHATEST_ON"); val.SetOverrideTag("RenderType", "TransparentCutout"); val.renderQueue = 2450; } mats.Add(val); return val; } private void ApplyDissolve() { //IL_008e: 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) if (StarPlatinumConfig.UseDissolve.Value) { float num = Mathf.Clamp(dissolve, 0f, 0.995f); { foreach (Material mat in mats) { mat.SetFloat("_AlphaCutoff", num); } return; } } float num2 = Mathf.Max(0.001f, 1f - dissolve) * StarPlatinumConfig.StandScale.Value * 2f; model.transform.localScale = Vector3.one * num2; } public void Summon(bool instant) { //IL_0026: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) IsSummoned = true; model.SetActive(true); dissolveTarget = 0f; ((Component)this).transform.position = TargetPosition(fight: false); ((Component)this).transform.rotation = Quaternion.Euler(0f, OwnerYaw(), 0f); vel = Vector3.zero; if (instant) { dissolve = 0f; } else { dissolve = 1f; } ApplyDissolve(); anim.SetTrigger("Summon"); } public void Dismiss() { if (IsSummoned) { IsSummoned = false; StopBarrage(); dissolveTarget = 1f; anim.SetTrigger("Dismiss"); } } public void Punch(bool right, float aimPitch = 0f) { if (IsSummoned) { attackUntil = Time.time + 0.6f; attackPitch = Mathf.Clamp(aimPitch, -85f, 85f); anim.SetTrigger(right ? "PunchR" : "PunchL"); Play(StarPlatinumAssets.Punch); } } public void StartBarrage(float aimPitch = 0f) { if (IsSummoned && !barrage) { barrage = true; attackPitch = Mathf.Clamp(aimPitch, -85f, 85f); anim.SetBool("Barrage", true); if ((Object)(object)StarPlatinumAssets.Barrage != (Object)null) { loop.volume = StarPlatinumConfig.Volume.Value; loop.Play(); } } } public void StopBarrage() { if (barrage) { barrage = false; if ((Object)(object)anim != (Object)null) { anim.SetBool("Barrage", false); } loop.Stop(); } } public void CastTimeStop() { if (IsSummoned) { attackUntil = Time.time + 1.6f; attackPitch = 0f; anim.SetTrigger("TimeStop"); } } public void PlayTaunt(int variant) { AudioClip val = ((variant == 1) ? StarPlatinumAssets.Taunt2 : StarPlatinumAssets.Taunt); if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)("Не загружен выбранный таунт: " + ((variant == 1) ? "sp_taunt2" : "sp_taunt") + ". Пересоберите AssetBundle и замените его рядом с DLL.")); } else { Play(val); } } private void Play(AudioClip c) { if (!((Object)(object)c == (Object)null)) { sfx.volume = StarPlatinumConfig.Volume.Value; sfx.PlayOneShot(c); } } private float OwnerYaw() { //IL_0041: 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) if (IsLocal && (Object)(object)Owner.gameplayCamera != (Object)null) { return ((Component)Owner.gameplayCamera).transform.eulerAngles.y; } return ((Component)Owner).transform.eulerAngles.y; } private Vector3 TargetPosition(bool fight) { //IL_0028: 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_002d: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //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_0081: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (fight ? new Vector3(0.8f, 0.15f, 1.65f) : new Vector3(0.95f, 0.35f, 1.25f)); Vector3 result = ((Component)Owner).transform.position + Quaternion.Euler(0f, OwnerYaw(), 0f) * val; result.y += Mathf.Sin(bob * 1.6f) * 0.08f; return result; } private void Update() { //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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_008b: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_014e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Owner == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { if (!model.activeSelf) { return; } float deltaTime = Time.deltaTime; bob += deltaTime; bool fight = barrage || Time.time < attackUntil; Vector3 val = TargetPosition(fight); Vector3 val2 = val - ((Component)this).transform.position; if (((Vector3)(ref val2)).sqrMagnitude > 225f) { ((Component)this).transform.position = val; vel = Vector3.zero; } else { ((Component)this).transform.position = Vector3.SmoothDamp(((Component)this).transform.position, val, ref vel, 0.12f); } if (barrage && IsLocal && (Object)(object)Owner.gameplayCamera != (Object)null) { attackPitch = StarPlatinumCombat.GetAimPitch(Owner); } Quaternion val3 = Quaternion.Euler((barrage || Time.time < attackUntil) ? attackPitch : 0f, OwnerYaw(), 0f); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val3, 1f - Mathf.Exp(-12f * deltaTime)); float magnitude = ((Vector3)(ref vel)).magnitude; anim.SetFloat("Speed", (magnitude > 4f) ? magnitude : 0f); if (!Mathf.Approximately(dissolve, dissolveTarget)) { dissolve = Mathf.MoveTowards(dissolve, dissolveTarget, deltaTime / 1.2f); ApplyDissolve(); if (dissolve >= 1f && !IsSummoned) { model.SetActive(false); } } } } private void OnDestroy() { foreach (Material mat in mats) { if ((Object)(object)mat != (Object)null) { Object.Destroy((Object)(object)mat); } } } }