using 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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("REPOJP")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("REPOJP")]
[assembly: AssemblyTitle("REPOJP")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[BepInPlugin("REPOJP.AntiValuableGrief", "AntiValuableGrief", "1.0.0")]
public class AntiValuableGriefPlugin : BaseUnityPlugin
{
private sealed class DamageEvent
{
public float Time;
public float Amount;
public string ValuableName = string.Empty;
}
private sealed class PlayerDamageTracker
{
public int StableId;
public string PlayerName = string.Empty;
public string SteamId = string.Empty;
public readonly Queue<DamageEvent> WindowEvents = new Queue<DamageEvent>();
public float WindowDamage;
public float LevelTotalDamage;
public int AlertCount;
public float LastSeenTime;
public string LastValuableName = string.Empty;
}
private sealed class PlayerShareIdentity
{
public int StableId;
public string PlayerName = string.Empty;
public string SteamId = string.Empty;
}
private sealed class ValuableHolderRecord
{
public int ValuableStableId;
public string ValuableName = string.Empty;
public float LastSeenTime;
public readonly List<PlayerShareIdentity> LastKnownHolders = new List<PlayerShareIdentity>();
}
private sealed class OverlayMessage
{
public string Text = string.Empty;
public string TeleportHint = string.Empty;
public float CreatedAt;
public float ExpiresAt;
public int TargetStableId;
public string TargetPlayerName = string.Empty;
}
private sealed class PlayerOutlineShellMarker : MonoBehaviour
{
}
private sealed class PlayerOutlineShellController : MonoBehaviour
{
private Material outlineMaterial;
private PlayerAvatar targetPlayer;
private readonly List<GameObject> outlineShellObjects = new List<GameObject>();
private bool outlineVisible;
private Color outlineColor = new Color(1f, 0.12f, 0.12f, 1f);
private float lastBuildAttemptTime;
private const float OutlineScaleMultiplier = 1.06f;
private const float RebuildRetrySeconds = 1f;
public void Initialize(PlayerAvatar player)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
targetPlayer = player;
((Object)this).hideFlags = (HideFlags)61;
EnsureOutlineMaterial();
TryBuildOutlineShells();
SetOutlineVisible(visible: false, outlineColor);
}
public void SetOutlineVisible(bool visible, Color color)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
outlineVisible = visible;
outlineColor = color;
EnsureOutlineMaterial();
ApplyOutlineMaterialColor();
if (outlineVisible)
{
TryBuildOutlineShells();
}
ApplyOutlineVisibility();
}
private void Update()
{
if ((Object)(object)targetPlayer == (Object)null)
{
Object.Destroy((Object)(object)this);
}
else if (outlineVisible && (outlineShellObjects.Count == 0 || !HasAnyValidShell()) && Time.unscaledTime - lastBuildAttemptTime >= 1f)
{
TryBuildOutlineShells();
ApplyOutlineVisibility();
}
}
private void OnDestroy()
{
ClearOutlineShells();
if ((Object)(object)outlineMaterial != (Object)null)
{
Object.Destroy((Object)(object)outlineMaterial);
outlineMaterial = null;
}
}
private void EnsureOutlineMaterial()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
if ((Object)(object)outlineMaterial != (Object)null)
{
return;
}
Shader val = Shader.Find("Standard");
if ((Object)(object)val == (Object)null)
{
val = Shader.Find("Legacy Shaders/Diffuse");
}
if ((Object)(object)val == (Object)null)
{
val = Shader.Find("Sprites/Default");
}
if (!((Object)(object)val == (Object)null))
{
outlineMaterial = new Material(val);
((Object)outlineMaterial).name = "AntiValuableGriefDetectedOutline";
((Object)outlineMaterial).hideFlags = (HideFlags)61;
outlineMaterial.enableInstancing = true;
if (outlineMaterial.HasProperty("_Glossiness"))
{
outlineMaterial.SetFloat("_Glossiness", 0f);
}
if (outlineMaterial.HasProperty("_Metallic"))
{
outlineMaterial.SetFloat("_Metallic", 0f);
}
if (outlineMaterial.HasProperty("_Cull"))
{
outlineMaterial.SetInt("_Cull", 1);
}
if (outlineMaterial.HasProperty("_ZWrite"))
{
outlineMaterial.SetInt("_ZWrite", 1);
}
ApplyOutlineMaterialColor();
}
}
private void ApplyOutlineMaterialColor()
{
//IL_0035: 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_007d: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)outlineMaterial == (Object)null))
{
if (outlineMaterial.HasProperty("_Color"))
{
outlineMaterial.SetColor("_Color", outlineColor);
}
if (outlineMaterial.HasProperty("_EmissionColor"))
{
outlineMaterial.EnableKeyword("_EMISSION");
outlineMaterial.SetColor("_EmissionColor", outlineColor * 1.8f);
}
}
}
private void ApplyOutlineVisibility()
{
for (int i = 0; i < outlineShellObjects.Count; i++)
{
GameObject val = outlineShellObjects[i];
if ((Object)(object)val != (Object)null)
{
val.SetActive(outlineVisible);
}
}
}
private bool HasAnyValidShell()
{
for (int i = 0; i < outlineShellObjects.Count; i++)
{
if ((Object)(object)outlineShellObjects[i] != (Object)null)
{
return true;
}
}
return false;
}
private void TryBuildOutlineShells()
{
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: 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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
lastBuildAttemptTime = Time.unscaledTime;
if ((Object)(object)targetPlayer == (Object)null || (Object)(object)outlineMaterial == (Object)null)
{
return;
}
ClearOutlineShells();
PlayerAvatarVisuals playerAvatarVisuals = targetPlayer.playerAvatarVisuals;
if ((Object)(object)playerAvatarVisuals == (Object)null || (Object)(object)playerAvatarVisuals.meshParent == (Object)null)
{
return;
}
SkinnedMeshRenderer[] componentsInChildren = playerAvatarVisuals.meshParent.GetComponentsInChildren<SkinnedMeshRenderer>(true);
foreach (SkinnedMeshRenderer val in componentsInChildren)
{
if (!((Object)(object)val == (Object)null) && ((Renderer)val).enabled && !((Object)(object)((Component)val).gameObject.GetComponent<PlayerOutlineShellMarker>() != (Object)null))
{
GameObject val2 = new GameObject(((Object)((Component)val).gameObject).name + "_AntiValuableGriefOutlineShell");
((Object)val2).hideFlags = (HideFlags)61;
val2.transform.SetParent(((Component)val).transform, false);
val2.transform.localPosition = Vector3.zero;
val2.transform.localRotation = Quaternion.identity;
val2.transform.localScale = Vector3.one * 1.06f;
val2.AddComponent<PlayerOutlineShellMarker>();
SkinnedMeshRenderer val3 = val2.AddComponent<SkinnedMeshRenderer>();
val3.sharedMesh = val.sharedMesh;
val3.rootBone = val.rootBone;
val3.bones = val.bones;
((Renderer)val3).sharedMaterial = outlineMaterial;
((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0;
((Renderer)val3).receiveShadows = false;
((Renderer)val3).lightProbeUsage = (LightProbeUsage)0;
((Renderer)val3).reflectionProbeUsage = (ReflectionProbeUsage)0;
((Renderer)val3).motionVectorGenerationMode = (MotionVectorGenerationMode)2;
val3.updateWhenOffscreen = true;
((Renderer)val3).allowOcclusionWhenDynamic = false;
((Renderer)val3).probeAnchor = ((Renderer)val).probeAnchor;
((Renderer)val3).localBounds = ((Renderer)val).localBounds;
((Renderer)val3).enabled = outlineVisible;
outlineShellObjects.Add(val2);
}
}
}
private void ClearOutlineShells()
{
for (int i = 0; i < outlineShellObjects.Count; i++)
{
GameObject val = outlineShellObjects[i];
if ((Object)(object)val != (Object)null)
{
Object.Destroy((Object)(object)val);
}
}
outlineShellObjects.Clear();
}
}
[HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "BreakRPC")]
private static class PhysGrabObjectImpactDetectorBreakPatch
{
private static void Postfix(PhysGrabObjectImpactDetector __instance, float valueLost, Vector3 _contactPoint, int breakLevel, bool _loseValue)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Instance == (Object)null))
{
Instance.HandleValuableBreak(__instance, valueLost, _contactPoint, breakLevel, _loseValue);
}
}
}
[CompilerGenerated]
private sealed class <LoadWarningAudioCoroutine>d__105 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string filePath;
public AntiValuableGriefPlugin <>4__this;
private string <uri>5__1;
private UnityWebRequest <request>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadWarningAudioCoroutine>d__105(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<uri>5__1 = null;
<request>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Invalid comparison between Unknown and I4
bool result;
try
{
switch (<>1__state)
{
default:
result = false;
break;
case 0:
<>1__state = -1;
<uri>5__1 = new Uri(filePath).AbsoluteUri;
<request>5__2 = UnityWebRequestMultimedia.GetAudioClip(<uri>5__1, (AudioType)14);
<>1__state = -3;
<>2__current = <request>5__2.SendWebRequest();
<>1__state = 1;
result = true;
break;
case 1:
<>1__state = -3;
if ((int)<request>5__2.result != 1)
{
DebugLog("Warning audio load failed / 警告音読込失敗\n" + <request>5__2.error);
<>4__this.warningAudioClip = <>4__this.CreateFallbackWarningClip();
result = false;
<>m__Finally1();
break;
}
<>4__this.warningAudioClip = DownloadHandlerAudioClip.GetContent(<request>5__2);
if ((Object)(object)<>4__this.warningAudioClip == (Object)null)
{
<>4__this.warningAudioClip = <>4__this.CreateFallbackWarningClip();
}
<>m__Finally1();
<request>5__2 = null;
result = false;
break;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
return result;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<request>5__2 != null)
{
((IDisposable)<request>5__2).Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
internal static AntiValuableGriefPlugin Instance;
internal static ManualLogSource LogSource;
internal static ConfigEntry<bool> EnableMod;
internal static ConfigEntry<bool> EnableDebugLog;
internal static ConfigEntry<float> TimeWindowSeconds;
internal static ConfigEntry<float> DamageThresholdAmount;
internal static ConfigEntry<bool> WarnInConsole;
internal static ConfigEntry<bool> ShowWarningOverlay;
internal static ConfigEntry<int> WarningFontSize;
internal static ConfigEntry<float> WarningDisplaySeconds;
internal static ConfigEntry<float> DetectedPlayerOutlineSeconds;
internal static ConfigEntry<string> TeleportToWarningPlayerKey;
internal static ConfigEntry<bool> PrintShopRanking;
internal static ConfigEntry<bool> StopMonitoringAfterFinalExtraction;
internal static ConfigEntry<string> LanguageSetting;
private Harmony harmony;
private static FieldInfo fiSteamId;
private static FieldInfo fiPlayerName;
private static FieldInfo fiDeadSet;
private static FieldInfo fiClientPosition;
private static FieldInfo fiClientPositionCurrent;
private static FieldInfo fiClientRotation;
private static FieldInfo fiClientRotationCurrent;
private static FieldInfo fiPcVelocityRelativeNew;
private static FieldInfo fiPcVelocityImpulse;
private static FieldInfo fiPcMoveForceDirection;
private static FieldInfo fiPcMoveForceAmount;
private static FieldInfo fiPcMoveForceTimer;
private static FieldInfo fiPcPositionPrevious;
private readonly Dictionary<int, PlayerDamageTracker> trackerMap = new Dictionary<int, PlayerDamageTracker>();
private readonly Dictionary<int, ValuableHolderRecord> valuableHolderMap = new Dictionary<int, ValuableHolderRecord>();
private readonly List<OverlayMessage> overlayMessages = new List<OverlayMessage>();
private readonly Dictionary<int, float> detectedOutlineExpireMap = new Dictionary<int, float>();
private readonly Dictionary<int, PlayerOutlineShellController> outlineControllerMap = new Dictionary<int, PlayerOutlineShellController>();
private bool previousRunIsLevel;
private bool shopRankingPrintedForCurrentLevel;
private bool monitoringStoppedForCurrentLevel;
private bool autoTranslatorChecked;
private readonly float autoTranslatorCheckTime = 8f;
private float valuableScanTimer;
private AudioSource warningAudioSource;
private AudioClip warningAudioClip;
private bool warningAudioLoadStarted;
private Texture2D warningBarGradientTexture;
private const float WarningFadeInSeconds = 0.25f;
private const float WarningFadeOutSeconds = 0.25f;
private const float ValuableScanIntervalSeconds = 0.2f;
private const string WarningAudioDirectoryName = "AntiValuableGrief";
private const string WarningAudioFileName = "warning_detect.ogg";
private void Awake()
{
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Expected O, but got Unknown
//IL_0406: Unknown result type (might be due to invalid IL or missing references)
//IL_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_0434: Unknown result type (might be due to invalid IL or missing references)
//IL_043e: Expected O, but got Unknown
try
{
((Component)this).transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
Instance = this;
LogSource = ((BaseUnityPlugin)this).Logger;
EnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableMod", true, "Enable or disable this mod. このMOD全体の有効無効を切り替えます");
EnableDebugLog = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableDebugLog", false, "Enable detailed debug logs in the console. コンソールへ詳細なデバッグログを出力します");
TimeWindowSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Detection", "TimeWindowSeconds", 60f, "Damage accumulation window in seconds. 損害額を合算する時間窓の秒数です");
DamageThresholdAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Detection", "DamageThresholdAmount", 50000f, "Damage amount required within the time window before warning. 警告を出すために時間窓内で必要な損害額です");
WarnInConsole = ((BaseUnityPlugin)this).Config.Bind<bool>("Warning", "WarnInConsole", true, "Write warning messages to the BepInEx console and log output. BepInExのコンソールとログへ警告文を出力します");
ShowWarningOverlay = ((BaseUnityPlugin)this).Config.Bind<bool>("Warning", "ShowWarningOverlay", true, "Show warning messages as an animated on-screen overlay on your client. あなたのクライアント画面上にアニメーション付き警告オーバーレイを表示します");
WarningFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("Warning", "WarningFontSize", 26, "Font size used by the warning popup text. 警告ポップアップの文字サイズです");
WarningDisplaySeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Warning", "WarningDisplaySeconds", 5f, "How long the warning popup stays visible before it starts fading out. 警告ポップアップを表示し続けてからフェードアウトを始めるまでの秒数です");
DetectedPlayerOutlineSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Warning", "DetectedPlayerOutlineSeconds", 5f, "How long the detected player stays outlined after each alert. 検知対象プレイヤーへアウトラインを表示し続ける秒数です");
TeleportToWarningPlayerKey = ((BaseUnityPlugin)this).Config.Bind<string>("Warning", "TeleportToWarningPlayerKey", "J", "Key used to instantly teleport behind the currently displayed warning target while the popup is visible. ポップアップ表示中に現在表示中の警告対象の真後ろへ即時TPするキーです");
PrintShopRanking = ((BaseUnityPlugin)this).Config.Bind<bool>("Summary", "PrintShopRanking", true, "Print the level damage ranking when entering the shop after the level ends. レベル終了後にショップへ入った時、そのレベルの損害額ランキングを出力します");
StopMonitoringAfterFinalExtraction = ((BaseUnityPlugin)this).Config.Bind<bool>("Summary", "StopMonitoringAfterFinalExtraction", true, "Stop monitoring when the final extraction is completed. 最終納品完了時に監視を停止します");
LanguageSetting = ((BaseUnityPlugin)this).Config.Bind<string>("Localization", "LanguageSetting", "English", new ConfigDescription("Language used by the MOD UI and warning text. Supported values are English, Japanese, Korean, Chinese and Russian. MODのUIと警告文で使う言語です。English、Japanese、Korean、Chinese、Russian に対応しています", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[5] { "English", "Japanese", "Korean", "Chinese", "Russian" }), Array.Empty<object>()));
ForceTeleportKeyToJ();
fiSteamId = AccessTools.Field(typeof(PlayerAvatar), "steamID");
fiPlayerName = AccessTools.Field(typeof(PlayerAvatar), "playerName");
fiDeadSet = AccessTools.Field(typeof(PlayerAvatar), "deadSet");
fiClientPosition = AccessTools.Field(typeof(PlayerAvatar), "clientPosition");
fiClientPositionCurrent = AccessTools.Field(typeof(PlayerAvatar), "clientPositionCurrent");
fiClientRotation = AccessTools.Field(typeof(PlayerAvatar), "clientRotation");
fiClientRotationCurrent = AccessTools.Field(typeof(PlayerAvatar), "clientRotationCurrent");
fiPcVelocityRelativeNew = AccessTools.Field(typeof(PlayerController), "VelocityRelativeNew");
fiPcVelocityImpulse = AccessTools.Field(typeof(PlayerController), "VelocityImpulse");
fiPcMoveForceDirection = AccessTools.Field(typeof(PlayerController), "MoveForceDirection");
fiPcMoveForceAmount = AccessTools.Field(typeof(PlayerController), "MoveForceAmount");
fiPcMoveForceTimer = AccessTools.Field(typeof(PlayerController), "MoveForceTimer");
fiPcPositionPrevious = AccessTools.Field(typeof(PlayerController), "positionPrevious");
warningAudioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
warningAudioSource.playOnAwake = false;
warningAudioSource.loop = false;
warningAudioSource.spatialBlend = 0f;
warningAudioSource.volume = 1f;
warningAudioSource.priority = 0;
warningAudioSource.ignoreListenerPause = true;
warningAudioSource.bypassReverbZones = true;
warningBarGradientTexture = CreateGradientTexture(new Color(1f, 0.18f, 0.18f, 1f), new Color(0.62f, 0f, 0f, 1f));
harmony = new Harmony("REPOJP.AntiValuableGrief");
harmony.PatchAll();
LogInfo(GetLocalizedText("Loaded"));
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Failure: Awake\n" + ex));
}
}
private void ForceTeleportKeyToJ()
{
if (TeleportToWarningPlayerKey != null)
{
string a = (TeleportToWarningPlayerKey.Value ?? string.Empty).Trim();
if (!string.Equals(a, "J", StringComparison.OrdinalIgnoreCase))
{
TeleportToWarningPlayerKey.Value = "J";
((BaseUnityPlugin)this).Config.Save();
}
}
}
private void OnDestroy()
{
DisableAllDetectedPlayerOutlines();
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
EnsureWarningAudioLoaded();
TryApplyJapaneseFromAutoTranslator();
bool flag = SafeRunIsLevel();
bool flag2 = SafeRunIsShop();
if (flag2 && previousRunIsLevel && PrintShopRanking.Value && !shopRankingPrintedForCurrentLevel)
{
PrintCurrentLevelDamageRanking();
shopRankingPrintedForCurrentLevel = true;
overlayMessages.Clear();
DisableAllDetectedPlayerOutlines();
}
if (!EnableMod.Value)
{
ClearAllStateForNonLevel();
previousRunIsLevel = flag;
return;
}
if (!flag)
{
if (!flag2)
{
ClearAllStateForNonLevel();
}
previousRunIsLevel = false;
return;
}
if (!previousRunIsLevel)
{
StartNewLevelState();
}
previousRunIsLevel = true;
float time = Time.time;
float num = Mathf.Max(Time.deltaTime, 0f);
if (StopMonitoringAfterFinalExtraction.Value && !monitoringStoppedForCurrentLevel && (Object)(object)RoundDirector.instance != (Object)null && RoundDirector.instance.allExtractionPointsCompleted)
{
monitoringStoppedForCurrentLevel = true;
overlayMessages.Clear();
DisableAllDetectedPlayerOutlines();
LogInfo(GetLocalizedText("MonitoringStopped"));
}
valuableScanTimer -= num;
if (valuableScanTimer <= 0f)
{
UpdateValuableHolderRecords(time);
valuableScanTimer = 0.2f;
}
HashSet<int> seenIds = BuildSeenPlayerIdSet(time);
CleanupOverlayMessages(time);
UpdateDetectedPlayerOutlines(time, seenIds);
HandleTeleportToCurrentWarning();
}
private void OnGUI()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Expected O, but got Unknown
//IL_00e4: 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: Expected O, but got Unknown
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_0395: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
if (!EnableMod.Value || !ShowWarningOverlay.Value || !SafeRunIsLevel())
{
return;
}
CleanupOverlayMessages(Time.time);
OverlayMessage currentOverlayMessage = GetCurrentOverlayMessage(Time.time);
if (currentOverlayMessage != null)
{
GUIStyle val = new GUIStyle(GUI.skin.box);
val.alignment = (TextAnchor)4;
val.fontSize = Mathf.Max(12, WarningFontSize.Value);
val.wordWrap = true;
GUIStyle val2 = new GUIStyle(GUI.skin.label);
val2.alignment = (TextAnchor)4;
val2.fontSize = Mathf.Max(12, WarningFontSize.Value);
val2.wordWrap = true;
val2.richText = false;
val2.normal.textColor = Color.white;
GUIStyle val3 = new GUIStyle(GUI.skin.label);
val3.alignment = (TextAnchor)4;
val3.fontSize = Mathf.Max(10, WarningFontSize.Value - 6);
val3.wordWrap = false;
val3.normal.textColor = new Color(1f, 1f, 1f, 0.95f);
float num = Mathf.Min(1160f, (float)Screen.width - 80f);
float num2 = Mathf.Max(102f, (float)WarningFontSize.Value + 66f);
float num3 = ((float)Screen.width - num) * 0.5f;
float num4 = (float)Screen.height * 0.7f;
float num5 = (float)Screen.height + num2 + 20f;
float num6 = Mathf.Max(0.5f, WarningDisplaySeconds.Value);
float num7 = 0.25f + num6 + 0.25f;
float num8 = Time.time - currentOverlayMessage.CreatedAt;
float num10;
float num11;
if (num8 < 0.25f)
{
float num9 = Mathf.Clamp01(num8 / 0.25f);
num10 = num9;
num11 = Mathf.Lerp(num5, num4, num9);
}
else if (num8 < 0.25f + num6)
{
num10 = 1f;
num11 = num4;
}
else
{
float num12 = Mathf.Clamp01((num8 - 0.25f - num6) / 0.25f);
num10 = 1f - num12;
num11 = Mathf.Lerp(num4, num5, num12);
}
float num13 = 1f - Mathf.Clamp01(num8 / num7);
float num14 = 10f;
float num15 = 18f;
float num16 = num - num15 * 2f;
float num17 = num11 + num2 - 18f;
Color color = GUI.color;
GUI.color = new Color(0f, 0f, 0f, 0.78f * num10);
GUI.Box(new Rect(num3, num11, num, num2), string.Empty, val);
GUI.color = new Color(1f, 1f, 1f, num10);
GUI.Label(new Rect(num3 + 16f, num11 + 8f, num - 32f, num2 - 46f), currentOverlayMessage.Text, val2);
GUI.Label(new Rect(num3 + 16f, num11 + num2 - 40f, num - 32f, 18f), currentOverlayMessage.TeleportHint, val3);
GUI.color = new Color(0f, 0f, 0f, 0.55f * num10);
GUI.Box(new Rect(num3 + num15, num17, num16, num14), string.Empty);
DrawRedGradientBar(new Rect(num3 + num15, num17, num16 * num13, num14), num10);
GUI.color = color;
}
}
private void DrawRedGradientBar(Rect rect, float alpha)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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)
if (!(((Rect)(ref rect)).width <= 0f) && !(((Rect)(ref rect)).height <= 0f))
{
Color color = GUI.color;
if ((Object)(object)warningBarGradientTexture != (Object)null)
{
GUI.color = new Color(1f, 1f, 1f, alpha);
GUI.DrawTexture(rect, (Texture)(object)warningBarGradientTexture, (ScaleMode)0, false);
}
GUI.color = color;
}
}
private void HandleValuableBreak(PhysGrabObjectImpactDetector impactDetector, float valueLost, Vector3 contactPoint, int breakLevel, bool loseValue)
{
if (!EnableMod.Value || !SafeRunIsLevel() || monitoringStoppedForCurrentLevel || !loseValue || (Object)(object)impactDetector == (Object)null || valueLost <= 0f)
{
return;
}
ValuableObject component = ((Component)impactDetector).GetComponent<ValuableObject>();
PhysGrabObject component2 = ((Component)impactDetector).GetComponent<PhysGrabObject>();
if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null)
{
return;
}
string valuableDisplayName = GetValuableDisplayName(component);
int stableValuableId = GetStableValuableId(((Component)component).gameObject);
List<PlayerShareIdentity> list = ResolveResponsibleHolders(stableValuableId, valuableDisplayName, component2);
if (list.Count <= 0)
{
DebugLog("No damage attribution holder found. 損害責任者を特定できませんでした\nValuable: " + valuableDisplayName + "\nValueLost: " + valueLost.ToString("F0"));
return;
}
float num = valueLost / (float)list.Count;
if (num <= 0f)
{
return;
}
float time = Time.time;
for (int i = 0; i < list.Count; i++)
{
PlayerShareIdentity playerShareIdentity = list[i];
if (playerShareIdentity != null && !IsLocalPlayerByStableId(playerShareIdentity.StableId))
{
PlayerDamageTracker orCreateTracker = GetOrCreateTracker(playerShareIdentity);
orCreateTracker.LastValuableName = valuableDisplayName;
AddDamageToTracker(orCreateTracker, num, time, valuableDisplayName);
}
}
}
private PlayerDamageTracker GetOrCreateTracker(PlayerShareIdentity holder)
{
if (!trackerMap.TryGetValue(holder.StableId, out PlayerDamageTracker value))
{
value = new PlayerDamageTracker();
value.StableId = holder.StableId;
trackerMap[holder.StableId] = value;
}
value.PlayerName = holder.PlayerName;
value.SteamId = holder.SteamId;
value.LastSeenTime = Time.time;
return value;
}
private void AddDamageToTracker(PlayerDamageTracker tracker, float amount, float now, string valuableName)
{
DamageEvent damageEvent = new DamageEvent();
damageEvent.Time = now;
damageEvent.Amount = amount;
damageEvent.ValuableName = valuableName;
tracker.WindowEvents.Enqueue(damageEvent);
tracker.WindowDamage += amount;
tracker.LevelTotalDamage += amount;
tracker.LastSeenTime = now;
PruneOldWindowEvents(tracker, now);
if (tracker.WindowDamage >= Mathf.Max(1f, DamageThresholdAmount.Value))
{
float windowDamage = tracker.WindowDamage;
tracker.AlertCount++;
EmitWarning(tracker, windowDamage, tracker.LevelTotalDamage);
ResetTrackerWindowAfterWarning(tracker);
}
}
private void PruneOldWindowEvents(PlayerDamageTracker tracker, float now)
{
float num = Mathf.Max(1f, TimeWindowSeconds.Value);
while (tracker.WindowEvents.Count > 0)
{
DamageEvent damageEvent = tracker.WindowEvents.Peek();
if (now - damageEvent.Time <= num)
{
break;
}
tracker.WindowDamage -= damageEvent.Amount;
tracker.WindowEvents.Dequeue();
}
if (tracker.WindowDamage < 0f)
{
tracker.WindowDamage = 0f;
}
}
private void ResetTrackerWindowAfterWarning(PlayerDamageTracker tracker)
{
tracker.WindowEvents.Clear();
tracker.WindowDamage = 0f;
}
private void EmitWarning(PlayerDamageTracker tracker, float windowDamage, float levelTotalDamage)
{
string text = string.Format(GetLocalizedText("WarningFormat"), tracker.PlayerName, FormatDollar(windowDamage), FormatDollar(levelTotalDamage), tracker.AlertCount);
if (WarnInConsole.Value)
{
LogInfo(text + " Valuable: " + tracker.LastValuableName);
}
if (ShowWarningOverlay.Value)
{
OverlayMessage overlayMessage = new OverlayMessage();
overlayMessage.Text = text;
overlayMessage.TeleportHint = string.Format(GetLocalizedText("TeleportHint"), GetDisplayTeleportKeyName());
overlayMessage.CreatedAt = Time.time;
overlayMessage.ExpiresAt = Time.time + 0.25f + Mathf.Max(0.5f, WarningDisplaySeconds.Value) + 0.25f;
overlayMessage.TargetStableId = tracker.StableId;
overlayMessage.TargetPlayerName = tracker.PlayerName;
overlayMessages.Add(overlayMessage);
PlayWarningSound();
MarkDetectedPlayerOutline(tracker.StableId);
}
}
private void HandleTeleportToCurrentWarning()
{
if (!ShowWarningOverlay.Value)
{
return;
}
OverlayMessage currentOverlayMessage = GetCurrentOverlayMessage(Time.time);
if (currentOverlayMessage != null && IsTeleportHotkeyPressed())
{
PlayerAvatar val = FindPlayerByStableId(currentOverlayMessage.TargetStableId);
if (!((Object)(object)val == (Object)null) && IsAlivePlayer(val))
{
TeleportLocalPlayerNearTarget(val);
}
}
}
private bool IsTeleportHotkeyPressed()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Invalid comparison between Unknown and I4
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown((KeyCode)106))
{
return true;
}
KeyCode val = ParseTeleportKey();
if ((int)val != 106 && Input.GetKeyDown(val))
{
return true;
}
return false;
}
private KeyCode ParseTeleportKey()
{
//IL_0057: 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
string text = ((TeleportToWarningPlayerKey != null) ? (TeleportToWarningPlayerKey.Value ?? string.Empty) : string.Empty);
if (string.IsNullOrWhiteSpace(text))
{
return (KeyCode)106;
}
try
{
return (KeyCode)Enum.Parse(typeof(KeyCode), text.Trim(), ignoreCase: true);
}
catch
{
return (KeyCode)106;
}
}
private string GetDisplayTeleportKeyName()
{
return "J";
}
private PlayerAvatar FindPlayerByStableId(int stableId)
{
if ((Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList == null)
{
return null;
}
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
if ((Object)(object)player == (Object)null || GetStablePlayerId(player) != stableId)
{
continue;
}
return player;
}
return null;
}
private void TeleportLocalPlayerNearTarget(PlayerAvatar target)
{
//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)
PlayerController instance = PlayerController.instance;
PlayerAvatar val = null;
if ((Object)(object)instance != (Object)null)
{
val = instance.playerAvatarScript;
}
if ((Object)(object)val == (Object)null)
{
val = PlayerAvatar.instance;
}
if (!((Object)(object)val == (Object)null))
{
ResolveTeleportPlacement(val, target, out var destination, out var rotation);
ManualLocalTeleport(val, destination, rotation);
}
}
private void ResolveTeleportPlacement(PlayerAvatar localPlayer, PlayerAvatar target, out Vector3 destination, out Quaternion rotation)
{
//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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//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_0032: 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_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_0045: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: 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_00ca: 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_00d6: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: 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_00fe: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: 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_0124: 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_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: 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)
//IL_017a: 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_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: 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_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: 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_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: 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_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: 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_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = ((Component)target).transform.position;
Vector3 val = Vector3.ProjectOnPlane(((Component)target).transform.forward, Vector3.up);
Vector3 val2 = ((Vector3)(ref val)).normalized;
val = Vector3.ProjectOnPlane(((Component)target).transform.right, Vector3.up);
Vector3 val3 = ((Vector3)(ref val)).normalized;
if (((Vector3)(ref val2)).sqrMagnitude <= 0.0001f)
{
val2 = Vector3.forward;
}
if (((Vector3)(ref val3)).sqrMagnitude <= 0.0001f)
{
val3 = Vector3.right;
}
Vector3[] array = (Vector3[])(object)new Vector3[7]
{
-val2 * 1.35f,
-val2 * 1.75f,
-val2 * 2.15f,
-val2 * 1.55f + val3 * 0.45f,
-val2 * 1.55f - val3 * 0.45f,
-val2 * 1.95f + val3 * 0.65f,
-val2 * 1.95f - val3 * 0.65f
};
destination = position + array[0] + Vector3.up * 0.08f;
RaycastHit val5 = default(RaycastHit);
for (int i = 0; i < array.Length; i++)
{
Vector3 val4 = position + array[i] + Vector3.up * 1.5f;
val4 = ((!Physics.Raycast(val4, Vector3.down, ref val5, 4f, -1, (QueryTriggerInteraction)1)) ? (position + array[i] + Vector3.up * 0.08f) : (((RaycastHit)(ref val5)).point + Vector3.up * 0.08f));
if (!IsTeleportSpotBlocked(localPlayer, target, val4))
{
destination = val4;
break;
}
}
rotation = Quaternion.LookRotation(val2, Vector3.up);
}
private bool IsTeleportSpotBlocked(PlayerAvatar localPlayer, PlayerAvatar target, Vector3 position)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_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_002c: 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)
Vector3 val = position + Vector3.up * 0.15f;
Vector3 val2 = position + Vector3.up * 1.45f;
Collider[] array = Physics.OverlapCapsule(val, val2, 0.35f, -1, (QueryTriggerInteraction)1);
foreach (Collider val3 in array)
{
if (!((Object)(object)val3 == (Object)null) && (!((Object)(object)localPlayer != (Object)null) || !((Component)val3).transform.IsChildOf(((Component)localPlayer).transform)) && (!((Object)(object)target != (Object)null) || !((Component)val3).transform.IsChildOf(((Component)target).transform)) && !val3.isTrigger)
{
return true;
}
}
return false;
}
private void ManualLocalTeleport(PlayerAvatar localPlayer, Vector3 destination, Quaternion rotation)
{
//IL_0031: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_008d: 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_0131: 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_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: 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_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: 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_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: 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_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: 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)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: 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_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_0343: Unknown result type (might be due to invalid IL or missing references)
//IL_0344: Unknown result type (might be due to invalid IL or missing references)
//IL_0408: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Unknown result type (might be due to invalid IL or missing references)
//IL_044e: Unknown result type (might be due to invalid IL or missing references)
PlayerController instance = PlayerController.instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
instance.InputDisable(0.2f);
instance.Kinematic(0.2f);
instance.MoveForce(Vector3.zero, 0f, 0f);
instance.Velocity = Vector3.zero;
instance.VelocityRelative = Vector3.zero;
SetFieldValue(fiPcPositionPrevious, instance, destination);
SetFieldValue(fiPcVelocityRelativeNew, instance, Vector3.zero);
SetFieldValue(fiPcVelocityImpulse, instance, Vector3.zero);
SetFieldValue(fiPcMoveForceDirection, instance, Vector3.zero);
SetFieldValue(fiPcMoveForceAmount, instance, 0f);
SetFieldValue(fiPcMoveForceTimer, instance, 0f);
if ((Object)(object)instance.CollisionController != (Object)null)
{
instance.CollisionController.ResetFalling();
}
if ((Object)(object)instance.CollisionGrounded != (Object)null)
{
instance.CollisionGrounded.physRiding = false;
instance.CollisionGrounded.physRidingID = 0;
instance.CollisionGrounded.physRidingPosition = Vector3.zero;
}
bool flag = false;
if (!GameManager.Multiplayer() || PhotonNetwork.IsMasterClient)
{
try
{
localPlayer.Spawn(destination, rotation);
flag = true;
}
catch (Exception ex)
{
DebugLog("Spawn teleport path failed. Spawn経路TP失敗\n" + ex);
}
}
if (!flag)
{
if ((Object)(object)instance.rb != (Object)null)
{
instance.rb.velocity = Vector3.zero;
instance.rb.angularVelocity = Vector3.zero;
instance.rb.position = destination;
instance.rb.rotation = rotation;
instance.rb.MovePosition(destination);
instance.rb.MoveRotation(rotation);
instance.rb.WakeUp();
}
((Component)instance).transform.position = destination;
((Component)instance).transform.rotation = rotation;
Rigidbody component = ((Component)localPlayer).GetComponent<Rigidbody>();
if ((Object)(object)component != (Object)null)
{
component.velocity = Vector3.zero;
component.angularVelocity = Vector3.zero;
component.position = destination;
component.rotation = rotation;
component.MovePosition(destination);
component.MoveRotation(rotation);
component.WakeUp();
}
((Component)localPlayer).transform.position = destination;
((Component)localPlayer).transform.rotation = rotation;
if ((Object)(object)localPlayer.playerTransform != (Object)null)
{
localPlayer.playerTransform.position = destination;
localPlayer.playerTransform.rotation = rotation;
}
SetFieldValue(fiClientPosition, localPlayer, destination);
SetFieldValue(fiClientPositionCurrent, localPlayer, destination);
SetFieldValue(fiClientRotation, localPlayer, rotation);
SetFieldValue(fiClientRotationCurrent, localPlayer, rotation);
if ((Object)(object)localPlayer.playerAvatarVisuals != (Object)null)
{
((Component)localPlayer.playerAvatarVisuals).transform.position = destination;
localPlayer.playerAvatarVisuals.visualPosition = destination;
}
}
else
{
if ((Object)(object)instance.rb != (Object)null)
{
instance.rb.velocity = Vector3.zero;
instance.rb.angularVelocity = Vector3.zero;
instance.rb.WakeUp();
}
Rigidbody component2 = ((Component)localPlayer).GetComponent<Rigidbody>();
if ((Object)(object)component2 != (Object)null)
{
component2.velocity = Vector3.zero;
component2.angularVelocity = Vector3.zero;
component2.WakeUp();
}
}
Physics.SyncTransforms();
if ((Object)(object)localPlayer.localCamera != (Object)null)
{
localPlayer.localCamera.Teleported();
}
if ((Object)(object)CameraAim.Instance != (Object)null)
{
CameraAim.Instance.SetPlayerAim(rotation, true);
CameraAim.Instance.OverrideNoSmooth(0.15f);
}
if ((Object)(object)CameraPosition.instance != (Object)null)
{
((Component)CameraPosition.instance).transform.position = destination;
((Component)CameraPosition.instance).transform.rotation = rotation;
}
if ((Object)(object)localPlayer.RoomVolumeCheck != (Object)null)
{
localPlayer.RoomVolumeCheck.CheckSet();
}
LogInfo("Teleport executed / TP実行 " + ((Vector3)(ref destination)).ToString("F2"));
}
private void UpdateValuableHolderRecords(float now)
{
List<ValuableObject> list = new List<ValuableObject>();
if ((Object)(object)ValuableDirector.instance != (Object)null && ValuableDirector.instance.valuableList != null && ValuableDirector.instance.valuableList.Count > 0)
{
for (int i = 0; i < ValuableDirector.instance.valuableList.Count; i++)
{
ValuableObject val = ValuableDirector.instance.valuableList[i];
if ((Object)(object)val != (Object)null)
{
list.Add(val);
}
}
}
else
{
ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>(false);
for (int j = 0; j < array.Length; j++)
{
if ((Object)(object)array[j] != (Object)null)
{
list.Add(array[j]);
}
}
}
HashSet<int> hashSet = new HashSet<int>();
for (int k = 0; k < list.Count; k++)
{
ValuableObject val2 = list[k];
if ((Object)(object)val2 == (Object)null)
{
continue;
}
PhysGrabObject val3 = val2.physGrabObject;
if ((Object)(object)val3 == (Object)null)
{
val3 = ((Component)val2).GetComponent<PhysGrabObject>();
}
if ((Object)(object)val3 == (Object)null)
{
continue;
}
int stableValuableId = GetStableValuableId(((Component)val2).gameObject);
hashSet.Add(stableValuableId);
if (!valuableHolderMap.TryGetValue(stableValuableId, out ValuableHolderRecord value))
{
value = new ValuableHolderRecord();
value.ValuableStableId = stableValuableId;
valuableHolderMap[stableValuableId] = value;
}
value.ValuableName = GetValuableDisplayName(val2);
value.LastSeenTime = now;
List<PlayerShareIdentity> distinctCurrentHolderIdentities = GetDistinctCurrentHolderIdentities(val3.playerGrabbing);
if (distinctCurrentHolderIdentities.Count > 0)
{
value.LastKnownHolders.Clear();
for (int l = 0; l < distinctCurrentHolderIdentities.Count; l++)
{
value.LastKnownHolders.Add(CloneIdentity(distinctCurrentHolderIdentities[l]));
}
}
else if ((Object)(object)val3.lastPlayerGrabbing != (Object)null && value.LastKnownHolders.Count <= 0)
{
value.LastKnownHolders.Clear();
value.LastKnownHolders.Add(BuildIdentity(val3.lastPlayerGrabbing));
}
}
List<int> list2 = new List<int>();
foreach (KeyValuePair<int, ValuableHolderRecord> item in valuableHolderMap)
{
if (!hashSet.Contains(item.Key) && now - item.Value.LastSeenTime > 10f)
{
list2.Add(item.Key);
}
}
for (int m = 0; m < list2.Count; m++)
{
valuableHolderMap.Remove(list2[m]);
}
}
private List<PlayerShareIdentity> ResolveResponsibleHolders(int valuableStableId, string valuableName, PhysGrabObject physGrabObject)
{
List<PlayerShareIdentity> distinctCurrentHolderIdentities = GetDistinctCurrentHolderIdentities(physGrabObject.playerGrabbing);
if (distinctCurrentHolderIdentities.Count > 0)
{
ValuableHolderRecord orCreateValuableRecord = GetOrCreateValuableRecord(valuableStableId, valuableName);
orCreateValuableRecord.LastKnownHolders.Clear();
for (int i = 0; i < distinctCurrentHolderIdentities.Count; i++)
{
orCreateValuableRecord.LastKnownHolders.Add(CloneIdentity(distinctCurrentHolderIdentities[i]));
}
return distinctCurrentHolderIdentities;
}
ValuableHolderRecord orCreateValuableRecord2 = GetOrCreateValuableRecord(valuableStableId, valuableName);
if (orCreateValuableRecord2.LastKnownHolders.Count > 0)
{
List<PlayerShareIdentity> list = new List<PlayerShareIdentity>();
for (int j = 0; j < orCreateValuableRecord2.LastKnownHolders.Count; j++)
{
list.Add(CloneIdentity(orCreateValuableRecord2.LastKnownHolders[j]));
}
return list;
}
if ((Object)(object)physGrabObject.lastPlayerGrabbing != (Object)null)
{
List<PlayerShareIdentity> list2 = new List<PlayerShareIdentity>();
list2.Add(BuildIdentity(physGrabObject.lastPlayerGrabbing));
return list2;
}
return new List<PlayerShareIdentity>();
}
private ValuableHolderRecord GetOrCreateValuableRecord(int valuableStableId, string valuableName)
{
if (!valuableHolderMap.TryGetValue(valuableStableId, out ValuableHolderRecord value))
{
value = new ValuableHolderRecord();
value.ValuableStableId = valuableStableId;
valuableHolderMap[valuableStableId] = value;
}
value.ValuableName = valuableName;
value.LastSeenTime = Time.time;
return value;
}
private List<PlayerShareIdentity> GetDistinctCurrentHolderIdentities(List<PhysGrabber> playerGrabbing)
{
Dictionary<int, PlayerShareIdentity> dictionary = new Dictionary<int, PlayerShareIdentity>();
if (playerGrabbing == null)
{
return new List<PlayerShareIdentity>();
}
for (int i = 0; i < playerGrabbing.Count; i++)
{
PhysGrabber val = playerGrabbing[i];
if (!((Object)(object)val == (Object)null) && !((Object)(object)val.playerAvatar == (Object)null))
{
PlayerShareIdentity playerShareIdentity = BuildIdentity(val.playerAvatar);
if (!dictionary.ContainsKey(playerShareIdentity.StableId))
{
dictionary.Add(playerShareIdentity.StableId, playerShareIdentity);
}
}
}
List<PlayerShareIdentity> list = new List<PlayerShareIdentity>();
foreach (KeyValuePair<int, PlayerShareIdentity> item in dictionary)
{
list.Add(item.Value);
}
return list;
}
private PlayerShareIdentity BuildIdentity(PlayerAvatar player)
{
PlayerShareIdentity playerShareIdentity = new PlayerShareIdentity();
playerShareIdentity.StableId = GetStablePlayerId(player);
playerShareIdentity.PlayerName = GetPlayerName(player);
playerShareIdentity.SteamId = GetSteamId(player);
return playerShareIdentity;
}
private PlayerShareIdentity CloneIdentity(PlayerShareIdentity source)
{
PlayerShareIdentity playerShareIdentity = new PlayerShareIdentity();
playerShareIdentity.StableId = source.StableId;
playerShareIdentity.PlayerName = source.PlayerName;
playerShareIdentity.SteamId = source.SteamId;
return playerShareIdentity;
}
private void PrintCurrentLevelDamageRanking()
{
List<PlayerDamageTracker> list = new List<PlayerDamageTracker>();
foreach (KeyValuePair<int, PlayerDamageTracker> item in trackerMap)
{
if (item.Value != null && item.Value.LevelTotalDamage > 0f)
{
list.Add(item.Value);
}
}
list.Sort((PlayerDamageTracker a, PlayerDamageTracker b) => b.LevelTotalDamage.CompareTo(a.LevelTotalDamage));
LogInfo("===== AntiValuableGrief Damage Ranking =====");
if (list.Count <= 0)
{
LogInfo("No attributed valuable damage for this level. このレベルで責任追跡できた損害はありませんでした");
LogInfo("============================================");
return;
}
for (int i = 0; i < list.Count; i++)
{
PlayerDamageTracker playerDamageTracker = list[i];
string message = string.Format("#{0} {1} Damage -${2} Alerts {3} Steam {4}", i + 1, playerDamageTracker.PlayerName, Mathf.RoundToInt(playerDamageTracker.LevelTotalDamage), playerDamageTracker.AlertCount, string.IsNullOrEmpty(playerDamageTracker.SteamId) ? "Unknown" : playerDamageTracker.SteamId);
LogInfo(message);
}
LogInfo("============================================");
}
private HashSet<int> BuildSeenPlayerIdSet(float now)
{
HashSet<int> hashSet = new HashSet<int>();
if ((Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList == null)
{
return hashSet;
}
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
if (!((Object)(object)player == (Object)null) && IsAlivePlayer(player))
{
int stablePlayerId = GetStablePlayerId(player);
hashSet.Add(stablePlayerId);
if (trackerMap.TryGetValue(stablePlayerId, out PlayerDamageTracker value) && value != null)
{
value.PlayerName = GetPlayerName(player);
value.SteamId = GetSteamId(player);
value.LastSeenTime = now;
}
}
}
CleanupMissingTrackers(now, hashSet);
return hashSet;
}
private void CleanupMissingTrackers(float now, HashSet<int> seenIds)
{
List<int> list = new List<int>();
foreach (KeyValuePair<int, PlayerDamageTracker> item in trackerMap)
{
if (!seenIds.Contains(item.Key) && now - item.Value.LastSeenTime > 30f && item.Value.LevelTotalDamage <= 0f)
{
list.Add(item.Key);
}
}
for (int i = 0; i < list.Count; i++)
{
trackerMap.Remove(list[i]);
}
}
private OverlayMessage GetCurrentOverlayMessage(float now)
{
OverlayMessage overlayMessage = null;
for (int i = 0; i < overlayMessages.Count; i++)
{
OverlayMessage overlayMessage2 = overlayMessages[i];
if (!(overlayMessage2.ExpiresAt <= now) && (overlayMessage == null || overlayMessage2.CreatedAt > overlayMessage.CreatedAt))
{
overlayMessage = overlayMessage2;
}
}
return overlayMessage;
}
private void CleanupOverlayMessages(float now)
{
for (int num = overlayMessages.Count - 1; num >= 0; num--)
{
if (overlayMessages[num].ExpiresAt <= now)
{
overlayMessages.RemoveAt(num);
}
}
}
private void MarkDetectedPlayerOutline(int stableId)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
float num = ((DetectedPlayerOutlineSeconds != null) ? Mathf.Max(0f, DetectedPlayerOutlineSeconds.Value) : 0f);
if (num <= 0f)
{
detectedOutlineExpireMap.Remove(stableId);
if (outlineControllerMap.TryGetValue(stableId, out PlayerOutlineShellController value) && (Object)(object)value != (Object)null)
{
value.SetOutlineVisible(visible: false, new Color(1f, 0.12f, 0.12f, 1f));
}
}
else
{
detectedOutlineExpireMap[stableId] = Time.time + num;
}
}
private void UpdateDetectedPlayerOutlines(float now, HashSet<int> seenIds)
{
//IL_010f: 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)
List<int> list = new List<int>();
foreach (KeyValuePair<int, float> item in detectedOutlineExpireMap)
{
if (item.Value <= now)
{
list.Add(item.Key);
}
}
for (int i = 0; i < list.Count; i++)
{
detectedOutlineExpireMap.Remove(list[i]);
}
Color color = default(Color);
((Color)(ref color))..ctor(1f, 0.12f, 0.12f, 1f);
foreach (KeyValuePair<int, PlayerOutlineShellController> item2 in outlineControllerMap)
{
PlayerOutlineShellController value = item2.Value;
if (!((Object)(object)value == (Object)null))
{
float value2;
bool visible = detectedOutlineExpireMap.TryGetValue(item2.Key, out value2) && value2 > now && seenIds.Contains(item2.Key);
value.SetOutlineVisible(visible, color);
}
}
foreach (KeyValuePair<int, float> item3 in detectedOutlineExpireMap)
{
if (item3.Value <= now || !seenIds.Contains(item3.Key))
{
continue;
}
PlayerAvatar val = FindPlayerByStableId(item3.Key);
if (!((Object)(object)val == (Object)null) && IsAlivePlayer(val))
{
PlayerOutlineShellController orCreateOutlineController = GetOrCreateOutlineController(val, item3.Key);
if ((Object)(object)orCreateOutlineController != (Object)null)
{
orCreateOutlineController.SetOutlineVisible(visible: true, color);
}
}
}
List<int> list2 = new List<int>();
foreach (KeyValuePair<int, PlayerOutlineShellController> item4 in outlineControllerMap)
{
if ((Object)(object)item4.Value == (Object)null)
{
list2.Add(item4.Key);
}
}
for (int j = 0; j < list2.Count; j++)
{
outlineControllerMap.Remove(list2[j]);
}
}
private PlayerOutlineShellController GetOrCreateOutlineController(PlayerAvatar player, int stableId)
{
if ((Object)(object)player == (Object)null)
{
return null;
}
if (outlineControllerMap.TryGetValue(stableId, out PlayerOutlineShellController value) && (Object)(object)value != (Object)null)
{
return value;
}
PlayerOutlineShellController playerOutlineShellController = ((Component)player).GetComponent<PlayerOutlineShellController>();
if ((Object)(object)playerOutlineShellController == (Object)null)
{
playerOutlineShellController = ((Component)player).gameObject.AddComponent<PlayerOutlineShellController>();
}
playerOutlineShellController.Initialize(player);
outlineControllerMap[stableId] = playerOutlineShellController;
return playerOutlineShellController;
}
private void DisableAllDetectedPlayerOutlines()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<int, PlayerOutlineShellController> item in outlineControllerMap)
{
if ((Object)(object)item.Value != (Object)null)
{
item.Value.SetOutlineVisible(visible: false, new Color(1f, 0.12f, 0.12f, 1f));
}
}
detectedOutlineExpireMap.Clear();
outlineControllerMap.Clear();
}
private void ClearAllStateForNonLevel()
{
overlayMessages.Clear();
DisableAllDetectedPlayerOutlines();
previousRunIsLevel = false;
monitoringStoppedForCurrentLevel = false;
valuableScanTimer = 0f;
}
private void StartNewLevelState()
{
trackerMap.Clear();
valuableHolderMap.Clear();
overlayMessages.Clear();
DisableAllDetectedPlayerOutlines();
monitoringStoppedForCurrentLevel = false;
shopRankingPrintedForCurrentLevel = false;
valuableScanTimer = 0f;
}
private int GetStablePlayerId(PlayerAvatar player)
{
PhotonView component = ((Component)player).GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null && component.ViewID != 0)
{
return component.ViewID;
}
return ((Object)player).GetInstanceID();
}
private int GetStableValuableId(GameObject gameObject)
{
if ((Object)(object)gameObject == (Object)null)
{
return 0;
}
PhotonView component = gameObject.GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null && component.ViewID != 0)
{
return component.ViewID;
}
return ((Object)gameObject).GetInstanceID();
}
private string GetPlayerName(PlayerAvatar player)
{
try
{
if (fiPlayerName != null)
{
object value = fiPlayerName.GetValue(player);
if (value is string text && !string.IsNullOrEmpty(text))
{
return text;
}
}
}
catch
{
}
return ((Object)(object)player != (Object)null) ? ((Object)player).name : "Unknown";
}
private string GetSteamId(PlayerAvatar player)
{
if (fiSteamId == null || (Object)(object)player == (Object)null)
{
return string.Empty;
}
object value = fiSteamId.GetValue(player);
return (value as string) ?? string.Empty;
}
private bool IsAlivePlayer(PlayerAvatar player)
{
if ((Object)(object)player == (Object)null)
{
return false;
}
if (fiDeadSet == null)
{
return true;
}
object value = fiDeadSet.GetValue(player);
bool flag = default(bool);
int num;
if (value is bool)
{
flag = (bool)value;
num = 1;
}
else
{
num = 0;
}
return ((uint)num & (flag ? 1u : 0u)) == 0;
}
private bool IsLocalPlayerByStableId(int stableId)
{
PlayerAvatar val = PlayerAvatar.instance;
if ((Object)(object)val == (Object)null && (Object)(object)PlayerController.instance != (Object)null)
{
val = PlayerController.instance.playerAvatarScript;
}
if ((Object)(object)val == (Object)null)
{
return false;
}
return GetStablePlayerId(val) == stableId;
}
private string GetValuableDisplayName(ValuableObject valuable)
{
if ((Object)(object)valuable == (Object)null)
{
return "Unknown Valuable";
}
return ((Object)((Component)valuable).gameObject).name;
}
private string FormatDollar(float value)
{
return Mathf.RoundToInt(value).ToString("N0");
}
private void PlayWarningSound()
{
EnsureWarningAudioLoaded();
if ((Object)(object)warningAudioSource == (Object)null)
{
warningAudioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
warningAudioSource.playOnAwake = false;
warningAudioSource.loop = false;
warningAudioSource.spatialBlend = 0f;
warningAudioSource.volume = 1f;
warningAudioSource.priority = 0;
warningAudioSource.ignoreListenerPause = true;
warningAudioSource.bypassReverbZones = true;
}
if ((Object)(object)warningAudioClip == (Object)null)
{
warningAudioClip = CreateFallbackWarningClip();
}
if (!((Object)(object)warningAudioSource == (Object)null) && !((Object)(object)warningAudioClip == (Object)null))
{
if ((Object)(object)warningAudioSource.outputAudioMixerGroup == (Object)null && (Object)(object)AudioManager.instance != (Object)null)
{
warningAudioSource.outputAudioMixerGroup = AudioManager.instance.SoundMasterGroup;
}
warningAudioSource.Stop();
warningAudioSource.PlayOneShot(warningAudioClip, 1f);
}
}
private void EnsureWarningAudioLoaded()
{
if ((Object)(object)warningAudioSource != (Object)null && (Object)(object)warningAudioSource.outputAudioMixerGroup == (Object)null && (Object)(object)AudioManager.instance != (Object)null)
{
warningAudioSource.outputAudioMixerGroup = AudioManager.instance.SoundMasterGroup;
}
if ((Object)(object)warningAudioClip == (Object)null)
{
warningAudioClip = CreateFallbackWarningClip();
}
if (!warningAudioLoadStarted)
{
string path = Path.Combine(Paths.ConfigPath, "AntiValuableGrief");
string text = Path.Combine(path, "warning_detect.ogg");
if (File.Exists(text))
{
warningAudioLoadStarted = true;
((MonoBehaviour)this).StartCoroutine(LoadWarningAudioCoroutine(text));
}
}
}
[IteratorStateMachine(typeof(<LoadWarningAudioCoroutine>d__105))]
private IEnumerator LoadWarningAudioCoroutine(string filePath)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadWarningAudioCoroutine>d__105(0)
{
<>4__this = this,
filePath = filePath
};
}
private AudioClip CreateFallbackWarningClip()
{
int num = Mathf.CeilToInt(18522f);
float[] array = new float[num];
for (int i = 0; i < num; i++)
{
float num2 = (float)i / 44100f;
float num3 = 1f;
if (num2 < 0.03f)
{
num3 = num2 / 0.03f;
}
else if (num2 > 0.33999997f)
{
num3 = Mathf.Clamp01((0.42f - num2) / 0.08f);
}
float num4 = ((num2 < 0.21f) ? 740f : 1180f);
float num5 = Mathf.Sin(num2 * num4 * MathF.PI * 2f);
float num6 = Mathf.Sin(num2 * (num4 * 0.5f) * MathF.PI * 2f) * 0.35f;
array[i] = (num5 * 0.65f + num6) * num3 * 0.28f;
}
AudioClip val = AudioClip.Create("AntiValuableGriefWarningFallback", num, 1, 44100, false);
val.SetData(array, 0);
return val;
}
private void SetFieldValue(FieldInfo fieldInfo, object instance, object value)
{
if (fieldInfo == null || instance == null)
{
return;
}
try
{
fieldInfo.SetValue(instance, value);
}
catch
{
}
}
private Texture2D CreateGradientTexture(Color leftColor, Color rightColor)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0036: 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_0039: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(256, 1, (TextureFormat)4, false, true);
((Texture)val).wrapMode = (TextureWrapMode)1;
((Object)val).hideFlags = (HideFlags)61;
for (int i = 0; i < ((Texture)val).width; i++)
{
float num = (float)i / (float)(((Texture)val).width - 1);
val.SetPixel(i, 0, Color.Lerp(leftColor, rightColor, num));
}
val.Apply(false, true);
return val;
}
private void TryApplyJapaneseFromAutoTranslator()
{
if (autoTranslatorChecked || Time.realtimeSinceStartup < autoTranslatorCheckTime)
{
return;
}
autoTranslatorChecked = true;
try
{
string path = Path.Combine(Paths.ConfigPath, "AutoTranslatorConfig.ini");
if (!File.Exists(path))
{
return;
}
string[] array = File.ReadAllLines(path);
foreach (string text in array)
{
if (string.IsNullOrWhiteSpace(text))
{
continue;
}
string text2 = text.Trim();
if (text2.StartsWith("Language=", StringComparison.OrdinalIgnoreCase))
{
string a = text2.Substring("Language=".Length).Trim();
if (string.Equals(a, "ja", StringComparison.OrdinalIgnoreCase) && !string.Equals(LanguageSetting.Value, "Japanese", StringComparison.OrdinalIgnoreCase))
{
LanguageSetting.Value = "Japanese";
((BaseUnityPlugin)this).Config.Save();
LogInfo(GetLocalizedText("AutoTranslatorJapaneseApplied"));
}
break;
}
}
}
catch (Exception ex)
{
DebugLog("AutoTranslator language check failed / AutoTranslator の言語確認に失敗\n" + ex);
}
}
private static string GetNormalizedLanguage()
{
string text = ((LanguageSetting != null) ? (LanguageSetting.Value ?? string.Empty) : string.Empty);
if (text.Equals("Japanese", StringComparison.OrdinalIgnoreCase))
{
return "ja";
}
if (text.Equals("Korean", StringComparison.OrdinalIgnoreCase))
{
return "ko";
}
if (text.Equals("Chinese", StringComparison.OrdinalIgnoreCase))
{
return "zh";
}
if (text.Equals("Russian", StringComparison.OrdinalIgnoreCase))
{
return "ru";
}
return "en";
}
private static string GetLocalizedText(string key)
{
string normalizedLanguage = GetNormalizedLanguage();
return key switch
{
"Loaded" => normalizedLanguage switch
{
"ja" => "読み込み完了",
"ko" => "로드 완료",
"zh" => "加载完成",
"ru" => "Загрузка завершена",
_ => "Loaded",
},
"MonitoringStopped" => normalizedLanguage switch
{
"ja" => "最終納品完了を検出したため監視を停止しました",
"ko" => "최종 납품 완료를 감지하여 감시를 중지했습니다",
"zh" => "检测到最终交付完成,已停止监视",
"ru" => "Обнаружено завершение финальной сдачи. Мониторинг остановлен",
_ => "Monitoring stopped because the final extraction was completed",
},
"AutoTranslatorJapaneseApplied" => normalizedLanguage switch
{
"ja" => "AutoTranslatorConfig.ini を検出したため、MOD言語設定を日本語へ自動変更しました",
"ko" => "AutoTranslatorConfig.ini가 감지되어 MOD 언어 설정이 일본어로 자동 변경되었습니다",
"zh" => "检测到 AutoTranslatorConfig.ini,MOD 语言已自动切换为日语",
"ru" => "Обнаружен AutoTranslatorConfig.ini, язык мода автоматически переключен на японский",
_ => "AutoTranslatorConfig.ini detected. MOD language setting was automatically changed to Japanese",
},
"WarningFormat" => normalizedLanguage switch
{
"ja" => "[荒らし検出] {0} 直近 -${1} 累計 -${2} 回数 {3}",
"ko" => "[방해 감지] {0} 최근 -${1} 누적 -${2} 횟수 {3}",
"zh" => "[恶意破坏检测] {0} 窗口 -${1} 累计 -${2} 次数 {3}",
"ru" => "[Обнаружение грифа] {0} Окно -${1} Всего -${2} Кол-во {3}",
_ => "[Grief Detected] {0} Window -${1} Level -${2} Count {3}",
},
"TeleportHint" => normalizedLanguage switch
{
"ja" => "{0}キーでTP",
"ko" => "{0} 키로 TP",
"zh" => "按 {0} 键传送",
"ru" => "TP на {0}",
_ => "{0} to TP",
},
_ => key,
};
}
private bool SafeRunIsLevel()
{
try
{
return SemiFunc.RunIsLevel();
}
catch
{
return false;
}
}
private bool SafeRunIsShop()
{
try
{
return SemiFunc.RunIsShop();
}
catch
{
return false;
}
}
internal static void LogInfo(string message)
{
if (LogSource != null)
{
LogSource.LogInfo((object)message);
}
}
internal static void DebugLog(string message)
{
if (EnableDebugLog != null && EnableDebugLog.Value && LogSource != null)
{
LogSource.LogInfo((object)message);
}
}
}