using System;
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
[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: AssemblyCompany("BetterThiefWarning")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0+759ae6af98b69e23690dc9ab2bfb8b99109ff393")]
[assembly: AssemblyProduct("BetterThiefWarning")]
[assembly: AssemblyTitle("BetterThiefWarning")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BetterThiefWarning
{
[BepInPlugin("BetterThiefWarning", "Better Thief Warning", "1.0.1")]
public class BetterThiefWarning : BaseUnityPlugin
{
private static Harmony Harmony;
public async void Awake()
{
Harmony = new Harmony("BetterThiefWarning");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Better Thief Warning Loaded!");
await Task.Delay(10000);
Harmony.PatchAll();
}
public void OnDestroy()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Better Thief Warning Unloaded!");
Harmony.UnpatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "BetterThiefWarning";
public const string PLUGIN_NAME = "BetterThiefWarning";
public const string PLUGIN_VERSION = "1.0.0.0";
}
}
namespace BetterThiefWarning.Patches
{
[HarmonyPatch(typeof(NPC_Info))]
public class NPC_InfoPatches
{
[HarmonyPostfix]
[HarmonyPatch("CreateNPCCharacter")]
private static void CreateNPCCharacter(NPC_Info __instance)
{
(from p in Chainloader.PluginInfos.Values
select p.Metadata into m
where m.Name == "DetroitSimulator"
select m).ToList().ForEach(delegate
{
__instance.isAThief = true;
});
if (!__instance.isAThief)
{
return;
}
Transform val = ((Component)__instance).transform.Find("ThiefCanvas");
if ((Object)(object)val == (Object)null)
{
return;
}
((Component)val).gameObject.SetActive(true);
Transform val2 = val.Find("ThiefSymbol");
if ((Object)(object)val2 == (Object)null)
{
return;
}
Transform val3 = val2.Find("Cross");
if (!((Object)(object)val3 == (Object)null))
{
Image component = ((Component)val2).GetComponent<Image>();
if (!((Object)(object)component == (Object)null))
{
((Component)val3).gameObject.SetActive(false);
((MonoBehaviour)__instance).StartCoroutine(SetImage(component, "https://i.ibb.co/Yp1WWvr/thief.png"));
}
}
}
[HarmonyPrefix]
[HarmonyPatch("UserCode_RpcShowThief")]
private static bool UserCode_RpcShowThief()
{
return false;
}
private static IEnumerator SetImage(Image image, string url)
{
UnityWebRequest www = UnityWebRequestTexture.GetTexture(url);
yield return www.SendWebRequest();
if ((int)www.result == 1)
{
Texture2D texture = DownloadHandlerTexture.GetContent(www);
image.sprite = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f));
((Transform)((Graphic)image).rectTransform).localScale = new Vector3(-1f, 1f, 1f);
}
}
}
}