using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using AssetBundleLoader;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using DDSScriptExtensions;
using DialogAdditions;
using HarmonyLib;
using HireAHitman.Dialog;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using MoonSharp.Interpreter;
using SOD.Common;
using SOD.Common.Extensions;
using SOD.Common.Helpers;
using SOD.Common.Helpers.GameplayObjects;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("HireAHitman")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyDescription("Hire a hitman to take care of an NPC you'd like to see removed")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+06d5deb0d90b7be7235b10e994fe3ae5f5b90213")]
[assembly: AssemblyProduct("HireAHitman")]
[assembly: AssemblyTitle("HireAHitman")]
[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 HireAHitman
{
internal class HireAHitmanHooks
{
internal class Patches_MurderController
{
[HarmonyPatch(typeof(MurderController), "PickNewMurderer")]
internal class MurderController_PickNewMurderer
{
private static List<MurderPreset> overriddenDisabledPresets = new List<MurderPreset>();
private static List<MurderMO> overriddenDisabledMOs = new List<MurderMO>();
private static bool wasHitmanDisabled = false;
public static void Prefix()
{
overriddenDisabledMOs.Clear();
overriddenDisabledPresets.Clear();
wasHitmanDisabled = HitmanMO.disabled;
if (TargetHumanIds.Count == 0)
{
return;
}
if (HireAHitmanPlugin.UseEasyCaseType.Value)
{
HitmanMO.disabled = true;
HitmanMOEasy.disabled = false;
}
else
{
HitmanMO.disabled = false;
HitmanMOEasy.disabled = true;
}
Enumerator<MurderMO> enumerator = Toolbox.Instance.allMurderMOs.GetEnumerator();
while (enumerator.MoveNext())
{
MurderMO current = enumerator.Current;
if (!current.disabled && (SoCustomComparison)(object)current != (SoCustomComparison)(object)HitmanMO && (SoCustomComparison)(object)current != (SoCustomComparison)(object)HitmanMOEasy)
{
overriddenDisabledMOs.Add(current);
current.disabled = true;
}
}
Enumerator<MurderPreset> enumerator2 = Toolbox.Instance.allMurderPresets.GetEnumerator();
while (enumerator2.MoveNext())
{
MurderPreset current2 = enumerator2.Current;
if (!current2.disabled && ((SoCustomComparison)current2).presetName != "ProfessionalHitPreset")
{
overriddenDisabledPresets.Add(current2);
current2.disabled = true;
}
}
}
public static void Postfix()
{
foreach (MurderMO overriddenDisabledMO in overriddenDisabledMOs)
{
overriddenDisabledMO.disabled = false;
}
overriddenDisabledMOs.Clear();
foreach (MurderPreset overriddenDisabledPreset in overriddenDisabledPresets)
{
overriddenDisabledPreset.disabled = false;
}
overriddenDisabledMOs.Clear();
HitmanMO.disabled = wasHitmanDisabled;
HitmanMOEasy.disabled = true;
}
}
[HarmonyPatch(typeof(MurderController), "PickNewVictim")]
internal class MurderController_PickNewVictim
{
public static bool Prefix(MurderController __instance)
{
if (TargetHumanIds.Count > 0)
{
currentHitmanTargetId = TargetHumanIds[0];
__instance.currentVictim = CityData.Instance.citizenDictionary[currentHitmanTargetId];
TargetHumanIds.RemoveAt(0);
if ((Object)(object)__instance.currentVictim == (Object)null || ((Actor)__instance.currentVictim).isPlayer || ((Actor)__instance.currentVictim).isDead || (Object)(object)__instance.currentMurderer == (Object)(object)__instance.currentVictim || ((Actor)__instance.currentVictim).isHomeless || __instance.previousMurderers.Contains(__instance.currentVictim))
{
HireAHitmanPlugin.PluginLogger.LogError((object)"Cannot find new valid victim!");
return true;
}
if (HireAHitmanPlugin.DebugMode.Value)
{
HireAHitmanPlugin.PluginLogger.LogInfo((object)("Murder: Chosen " + __instance.currentVictim.GetCitizenName() + " to be new victim..."));
if ((Object)(object)__instance.currentVictim.home != (Object)null)
{
HireAHitmanPlugin.PluginLogger.LogInfo((object)("Murder: Victim " + __instance.currentVictim.GetCitizenName() + " lives at " + ((Object)__instance.currentVictim.home).name));
}
}
if ((Object)(object)SideJobController.Instance != (Object)null)
{
SideJobController.Instance.DeadPeopleJobCheck();
}
return false;
}
return true;
}
}
}
internal class Dialog_HireHitman
{
[HarmonyPatch(typeof(CityData), "CreateSingletons")]
internal class CityData_CreateSingletons
{
public static void Postfix()
{
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Expected O, but got Unknown
if (hireHitmanAgencyResponseDialog == null)
{
hireHitmanAgencyResponseDialog = (CustomDialogPreset)(object)new HireHitmanAgencyDialog_Response();
hireHitmanAgencySelectDialog = (CustomDialogPreset)(object)new HireHitmanAgencyDialog_Select(hireHitmanAgencyResponseDialog);
hireHitmanAgencyWelcomeDialog = (CustomDialogPreset)(object)new HireHitmanAgencyDialog_Welcome(hireHitmanAgencySelectDialog);
DialogAdditionPlugin.LoadedCustomDialogPresets.Add(hireHitmanAgencyResponseDialog);
DialogAdditionPlugin.LoadedCustomDialogPresets.Add(hireHitmanAgencySelectDialog);
DialogAdditionPlugin.LoadedCustomDialogPresets.Add(hireHitmanAgencyWelcomeDialog);
DialogAdditionPlugin.AddDialogInterceptor(hireHitmanAgencyResponseDialog);
DialogAdditionPlugin.AddDialogInterceptor(hireHitmanAgencySelectDialog);
DialogAdditionPlugin.AddDialogInterceptor(hireHitmanAgencyWelcomeDialog);
PhotoSelectButtonController_OnLeftClick.CallTypes.Add(hireHitmanAgencySelectDialog.Name, HireHitmanAgencyDialog_Select.OnPhotoSelected);
}
string seed = CityData.Instance.seed;
FakePhoneNumber = Toolbox.Instance.GetPsuedoRandomNumber(7000000, 7999000, ref seed, false, false);
if (HireAHitmanPlugin.PublicPhoneNumber.Value)
{
GameplayController.Instance.AddOrMergePhoneNumberData(FakePhoneNumber, false, (List<Human>)null, "hireahitman", false);
}
TelephoneController.Instance.AddFakeNumber(FakePhoneNumber, new CallSource((CallType)3, hireHitmanAgencyWelcomeDialog.Preset, (ConversationType)0));
}
}
private static CustomDialogPreset hireHitmanAgencyResponseDialog;
private static CustomDialogPreset hireHitmanAgencySelectDialog;
private static CustomDialogPreset hireHitmanAgencyWelcomeDialog;
}
[HarmonyPatch(typeof(TextToImageController), "CaptureTextToImage")]
internal class TextToImageController_CaptureTextToImage
{
public static void Prefix(ref TextToImageSettings settings)
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Expected O, but got Unknown
if (!(settings.textSize < 0f))
{
return;
}
float textSize = settings.textSize;
float num = Mathf.Abs(settings.textSize);
settings.textSize = Mathf.Abs(MathF.Truncate(settings.textSize));
num -= settings.textSize;
settings.textString = FakePhoneNumber.ToString().Insert(3, "-");
if (HireAHitmanPlugin.DebugMode.Value)
{
ManualLogSource pluginLogger = HireAHitmanPlugin.PluginLogger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(46, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found override index ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" with textSize ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(settings.textSize);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" from raw ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(textSize);
}
pluginLogger.LogInfo(val);
ManualLogSource pluginLogger2 = HireAHitmanPlugin.PluginLogger;
val = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Selected output: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(settings.textString);
}
pluginLogger2.LogInfo(val);
}
}
}
[HarmonyPatch(typeof(Toolbox), "Start")]
public class Toolbox_Start
{
public static void Postfix()
{
Enumerator<ArtPreset> enumerator = Toolbox.Instance.allArt.GetEnumerator();
while (enumerator.MoveNext())
{
ArtPreset current = enumerator.Current;
if ((SoCustomComparison)(object)current != (SoCustomComparison)null && ((SoCustomComparison)current).presetName == "HitmanPhoneNumber")
{
current.material = Object.Instantiate<Material>(current.material);
current.material.mainTexture = (Texture)(object)Texture2DLoader.CreateTexture2DFromPNG(Assembly.GetExecutingAssembly(), Path.Join("HireAHitman", "hireAHitmanWallArt.png"));
}
}
HitmanMO = EnumerableExtensions.Where<MurderMO>(Toolbox.Instance.allMurderMOs, (Func<MurderMO, bool>)((MurderMO mo) => ((SoCustomComparison)mo).presetName == "ProfessionalHitMO")).First();
HitmanMOEasy = EnumerableExtensions.Where<MurderMO>(Toolbox.Instance.allMurderMOs, (Func<MurderMO, bool>)((MurderMO mo) => ((SoCustomComparison)mo).presetName == "EasyProfessionalHitMO")).First();
HitmanMO.disabled = !HireAHitmanPlugin.EnableHitmanInNormalGameplay.Value;
}
}
[HarmonyPatch(typeof(GenerationController), "PickArt")]
internal class GenerationController_PickArt
{
public static void Postfix(ArtPreset __result, NewRoom room)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
if (HireAHitmanPlugin.DebugMode.Value && __result.useDynamicText)
{
ManualLogSource pluginLogger = HireAHitmanPlugin.PluginLogger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(16, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Picked ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((SoCustomComparison)__result).presetName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" for ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(room.name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" in ");
NewGameLocation gameLocation = room.gameLocation;
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((gameLocation != null) ? ((Object)gameLocation).name : null);
}
pluginLogger.LogWarning(val);
}
}
}
public static List<int> TargetHumanIds = new List<int>();
public static int FakePhoneNumber = -1;
public static MurderMO HitmanMO;
public static MurderMO HitmanMOEasy;
private static int currentHitmanTargetId = -1;
public static bool AddHitmanTarget(Human human)
{
if (((Actor)human).isDead)
{
HireAHitmanPlugin.DebugLogIfEnabled((LogLevel)16, "Invalid target: " + human.citizenName + " - Already dead");
return false;
}
if (MurderController.Instance.previousMurderers.Contains(human))
{
HireAHitmanPlugin.DebugLogIfEnabled((LogLevel)16, "Invalid target: " + human.citizenName + " - Is a previous murderer");
return false;
}
if (TargetHumanIds.Contains(human.humanID))
{
HireAHitmanPlugin.DebugLogIfEnabled((LogLevel)16, "Invalid target: " + human.citizenName + " - Already a target");
return false;
}
TargetHumanIds.Add(human.humanID);
return true;
}
public static void VMailBuildingSecurity(object sender, VictimKilledArgs e)
{
if ((!((SoCustomComparison)(object)e.Murder.mo == (SoCustomComparison)(object)HitmanMO) && !((SoCustomComparison)(object)e.Murder.mo == (SoCustomComparison)(object)HitmanMOEasy)) || MurderController.Instance.activeMurders.Count != 1)
{
return;
}
Human val = null;
float num = float.MaxValue;
Enumerator<Acquaintance> enumerator = e.Murder.murderer.acquaintances.GetEnumerator();
while (enumerator.MoveNext())
{
Acquaintance current = enumerator.Current;
if (!((Actor)current.with).isDead && current.connections.Contains((ConnectionType)1))
{
float num2 = current.known - current.like;
if (num2 < num)
{
num = num2;
val = current.with;
}
}
}
if ((Object)(object)val == (Object)null)
{
HireAHitmanPlugin.DebugLogIfEnabled((LogLevel)16, "Not sending, no neighbour");
return;
}
Occupation? obj = (from occupation in EnumerableExtensions.ToList<Occupation>(CityData.Instance.jobsDirectory).FindAll((Occupation item) => (Object)(object)item.employee != (Object)null && ((Object)item.preset).name == "SecurityGuardDesk")
where ((NewGameLocation)occupation.employer.address).building.buildingID == ((NewGameLocation)e.Murder.murderer.home).building.buildingID
select occupation).FirstOrDefault();
Human val2 = ((obj != null) ? obj.employee : null);
if ((Object)(object)val2 == (Object)null)
{
HireAHitmanPlugin.DebugLogIfEnabled((LogLevel)16, "Not sending, no guard");
return;
}
if (HireAHitmanPlugin.DebugMode.Value)
{
HireAHitmanPlugin.DebugLogIfEnabled((LogLevel)16, "First murder, sending vmail from " + val.citizenName + " to " + val2.citizenName);
}
Toolbox.Instance.NewVmailThread(val, val2, (Human)null, (Human)null, (List<Human>)null, "17f7b4f4-56c6-444b-b1e8-7546fcbe3602", SessionData.Instance.gameTime + Toolbox.Instance.SeedRand(-48f, -12f), 999, (CustomDataSource)0, -1);
}
}
[BepInPlugin("HireAHitman", "HireAHitman", "1.0.0")]
public class HireAHitmanPlugin : BasePlugin
{
public static ConfigEntry<bool> Enabled;
public static ConfigEntry<int> CostToHire;
public static ConfigEntry<bool> PublicPhoneNumber;
public static ConfigEntry<bool> EnableHitmanInNormalGameplay;
public static ConfigEntry<bool> UseEasyCaseType;
public static ConfigEntry<bool> DebugMode;
private static HireAHitmanPlugin instance;
public static ManualLogSource PluginLogger;
private static HireAHitmanCustomDDSData hireAHitmanCustomDDSData;
public override void Load()
{
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Expected O, but got Unknown
PluginLogger = ((BasePlugin)this).Log;
instance = this;
Enabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Is the mod enabled at all? (Game restart required)");
CostToHire = ((BasePlugin)this).Config.Bind<int>("General", "CostToHire", 1000, "The cost to hire a hitman");
PublicPhoneNumber = ((BasePlugin)this).Config.Bind<bool>("General", "PublicPhoneNumber", false, "Show phone number in the phone known numbers section? (Once added, it can't be removed from that save)");
EnableHitmanInNormalGameplay = ((BasePlugin)this).Config.Bind<bool>("General", "EnableHitmanInNormalGameplay", false, "Should the Hitman case be used in the normal rotation? (Game restart required)");
UseEasyCaseType = ((BasePlugin)this).Config.Bind<bool>("General", "UseEasyCase", false, "Should the easy version of the case be used for a quick solve?");
DebugMode = ((BasePlugin)this).Config.Bind<bool>("Debug", "Enabled", false, "Is debug logging enabled?");
if (Enabled.Value)
{
ManualLogSource pluginLogger = PluginLogger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("HireAHitman");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
pluginLogger.LogInfo(val);
Harmony val2 = new Harmony("HireAHitman");
val2.PatchAll();
ManualLogSource pluginLogger2 = PluginLogger;
val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("HireAHitman");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched!");
}
pluginLogger2.LogInfo(val);
hireAHitmanCustomDDSData = new HireAHitmanCustomDDSData();
DDSScriptExtensionsPlugin.LuaScriptEnvironment.Globals[(object)"HireAHitmanData"] = UserData.Create((object)HireAHitmanCustomDDSData.Instance);
Lib.SaveGame.OnBeforeSave += SaveGame_OnBeforeSave;
Lib.SaveGame.OnBeforeLoad += SaveGame_OnBeforeLoad;
Lib.SaveGame.OnAfterLoad += SaveGame_OnAfterLoad;
Lib.Gameplay.OnVictimKilled += HireAHitmanHooks.VMailBuildingSecurity;
}
}
private void SaveGame_OnBeforeLoad(object sender, SaveGameArgs e)
{
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Expected O, but got Unknown
try
{
string savePath = GetSavePath(e.FilePath);
if (File.Exists(savePath))
{
dynamic val = NewtonsoftExtensions.NewtonsoftJson.JToken_Parse(File.ReadAllText(savePath));
HireAHitmanHooks.TargetHumanIds = val.ToObject<List<int>>();
}
}
catch (Exception ex)
{
ManualLogSource pluginLogger = PluginLogger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to save hired hitman targets: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
pluginLogger.LogError(val2);
}
}
private void SaveGame_OnAfterLoad(object sender, SaveGameArgs e)
{
if (PublicPhoneNumber.Value)
{
GameplayController.Instance.AddOrMergePhoneNumberData(HireAHitmanHooks.FakePhoneNumber, false, (List<Human>)null, "hireahitman", false);
}
}
private void SaveGame_OnBeforeSave(object sender, SaveGameArgs e)
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
bool flag = default(bool);
try
{
string savePath = GetSavePath(e.FilePath);
JsonSerializerOptions options = new JsonSerializerOptions
{
IncludeFields = true
};
File.WriteAllText(savePath, JsonSerializer.Serialize(HireAHitmanHooks.TargetHumanIds, options));
ManualLogSource pluginLogger = PluginLogger;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(44, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Successfully saved hired hitman targets at ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(savePath);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!");
}
pluginLogger.LogInfo(val);
}
catch (Exception ex)
{
ManualLogSource pluginLogger2 = PluginLogger;
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to save hired hitman targets: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
pluginLogger2.LogError(val2);
}
}
private string GetSavePath(string filePath)
{
string uniqueString = Lib.SaveGame.GetUniqueString(filePath);
string text = "HitmanTargetList_" + uniqueString + ".json";
return Lib.SaveGame.GetSavestoreDirectoryPath(Assembly.GetExecutingAssembly(), text);
}
public static void DebugLogIfEnabled(LogLevel logLevel, string value)
{
//IL_0010: 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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Invalid comparison between Unknown and I4
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Invalid comparison between Unknown and I4
if (!DebugMode.Value)
{
return;
}
if ((int)logLevel != 2)
{
if ((int)logLevel != 4)
{
if ((int)logLevel == 16)
{
PluginLogger.LogInfo((object)value);
}
}
else
{
PluginLogger.LogWarning((object)value);
}
}
else
{
PluginLogger.LogError((object)value);
}
}
}
public class HireAHitmanCustomDDSData
{
public static HireAHitmanCustomDDSData Instance;
public Human Target;
public HireAHitmanCustomDDSData()
{
Instance = this;
}
public string GetCostToHire()
{
return HireAHitmanPlugin.CostToHire.Value.ToString();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "HireAHitman";
public const string PLUGIN_NAME = "HireAHitman";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace HireAHitman.Dialog
{
internal class HireHitmanAgencyDialog_Response : CustomDialogPreset
{
public HireHitmanAgencyDialog_Response()
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Expected O, but got Unknown
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
((CustomDialogPreset)this).Name = "HireHitmanAgencyDialog_Response";
DialogPreset val = ScriptableObject.CreateInstance<DialogPreset>();
((SoCustomComparison)val).presetName = ((CustomDialogPreset)this).Name;
((Object)val).name = ((CustomDialogPreset)this).Name;
val.msgID = "";
val.defaultOption = false;
val.useSuccessTest = true;
val.baseChance = 1f;
val.ranking = 1;
val.removeAfterSaying = false;
val.telephoneCallOption = true;
val.responses.Add(new AISpeechPreset
{
dictionaryString = "Success",
ddsMessageID = "0f928a76-eaa9-4bf2-ac11-0a5fab1ecbfb",
isSuccessful = true,
chance = 1,
useParsing = true,
endsDialog = true
});
val.responses.Add(new AISpeechPreset
{
dictionaryString = "Fail",
ddsMessageID = "795afb08-f6e1-43fa-ac76-0c59ddcb25b7",
isSuccessful = false,
chance = 1,
useParsing = true,
endsDialog = true
});
((CustomDialogPreset)this).Preset = val;
}
public override bool IsAvailable(DialogPreset preset, Citizen saysTo, SideJob jobRef)
{
return false;
}
public override void RunDialogMethod(DialogController instance, Citizen saysTo, Interactable saysToInteractable, NewNode where, Actor saidBy, bool success, NewRoom roomRef, SideJob jobRef)
{
}
public override ForceSuccess ShouldDialogSucceedOverride(DialogController instance, DialogOption dialog, Citizen saysTo, NewNode where, Actor saidBy)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ForceSuccess)1;
}
}
internal class HireHitmanAgencyDialog_Select : CustomDialogPreset
{
private static CustomDialogPreset ResponseDialog;
public HireHitmanAgencyDialog_Select(CustomDialogPreset responseDialog)
{
((CustomDialogPreset)this).Name = "HireHitmanAgencyDialog_Select";
DialogPreset val = ScriptableObject.CreateInstance<DialogPreset>();
((SoCustomComparison)val).presetName = ((CustomDialogPreset)this).Name;
((Object)val).name = ((CustomDialogPreset)this).Name;
val.msgID = "";
val.defaultOption = false;
val.useSuccessTest = true;
val.baseChance = 0f;
val.ranking = 1;
val.removeAfterSaying = false;
val.telephoneCallOption = true;
((CustomDialogPreset)this).Preset = val;
ResponseDialog = responseDialog;
}
public override bool IsAvailable(DialogPreset preset, Citizen saysTo, SideJob jobRef)
{
return true;
}
public override void RunDialogMethod(DialogController instance, Citizen saysTo, Interactable saysToInteractable, NewNode where, Actor saidBy, bool success, NewRoom roomRef, SideJob jobRef)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
PhotoSelectButtonController_OnLeftClick.callType = ((CustomDialogPreset)this).Name;
SessionData.Instance.PauseGame(true, false, true);
instance.askTarget = null;
instance.askTargetKeys.Clear();
instance.askWindow = InterfaceController.Instance.SpawnWindow((Evidence)null, (DataKey)0, (List<DataKey>)null, "SelectPhoto", true, false, InterfaceControls.Instance.handbookWindowPosition, (Interactable)null, (Case)null, (CaseElement)null, success);
}
public override ForceSuccess ShouldDialogSucceedOverride(DialogController instance, DialogOption dialog, Citizen saysTo, NewNode where, Actor saidBy)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ForceSuccess)1;
}
public static bool OnPhotoSelected(Human speaker, Human askTarget, List<DataKey> askTargetKeys)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Expected O, but got Unknown
if (HireAHitmanPlugin.DebugMode.Value)
{
ManualLogSource pluginLogger = HireAHitmanPlugin.PluginLogger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Asking about: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(askTarget.citizenName);
}
pluginLogger.LogInfo(val);
ManualLogSource pluginLogger2 = HireAHitmanPlugin.PluginLogger;
val = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\tKnows name: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(askTargetKeys.Contains((DataKey)0));
}
pluginLogger2.LogInfo(val);
ManualLogSource pluginLogger3 = HireAHitmanPlugin.PluginLogger;
val = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\tKnows address: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(askTargetKeys.Contains((DataKey)14));
}
pluginLogger3.LogInfo(val);
ManualLogSource pluginLogger4 = HireAHitmanPlugin.PluginLogger;
val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\tKnows photo: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(askTargetKeys.Contains((DataKey)1));
}
pluginLogger4.LogInfo(val);
}
bool flag2 = askTargetKeys.Contains((DataKey)0) && askTargetKeys.Contains((DataKey)14);
DialogOption val2 = new DialogOption
{
preset = ResponseDialog.Preset
};
if (flag2 && GameplayController.Instance.money >= HireAHitmanPlugin.CostToHire.Value && HireAHitmanHooks.AddHitmanTarget(askTarget))
{
GameplayController.Instance.AddMoney(-HireAHitmanPlugin.CostToHire.Value, true, "Hired a hitman");
HireAHitmanCustomDDSData.Instance.Target = askTarget;
DialogController.Instance.ExecuteDialog(val2, Player.Instance.phoneInteractable, ((Actor)Player.Instance).currentNode, (Actor)(object)Player.Instance, (ForceSuccess)1, (InteractionDialogInstance)null);
}
else
{
DialogController.Instance.ExecuteDialog(val2, Player.Instance.phoneInteractable, ((Actor)Player.Instance).currentNode, (Actor)(object)Player.Instance, (ForceSuccess)2, (InteractionDialogInstance)null);
}
return false;
}
}
internal class HireHitmanAgencyDialog_Welcome : CustomDialogPreset
{
[HarmonyPatch(typeof(SpeechBubbleController), "OnDestroy")]
public class DialogController_OnDialogEnd
{
public static Dictionary<string, Action<AISpeechPreset, string, Interactable, Actor, int>> WatchedPresets = new Dictionary<string, Action<AISpeechPreset, string, Interactable, Actor, int>>();
[HarmonyPrefix]
internal static void Prefix(SpeechBubbleController __instance)
{
if ((Object)(object)__instance != (Object)null && __instance.speech != null && __instance.speech.dialog != null && WatchedPresets.ContainsKey(__instance.speech.dialog.ddsMessageID))
{
WatchedPresets[__instance.speech.dialog.ddsMessageID](__instance.speech.dialog, null, null, null, 0);
}
}
}
private static AISpeechPreset aiSpeechPreset;
private CustomDialogPreset PhotoSelectDialog;
public HireHitmanAgencyDialog_Welcome(CustomDialogPreset photoSelectDialog)
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Expected O, but got Unknown
((CustomDialogPreset)this).Name = "HireHitmanAgencyDialog_Welcome";
DialogPreset val = ScriptableObject.CreateInstance<DialogPreset>();
((SoCustomComparison)val).presetName = ((CustomDialogPreset)this).Name;
((Object)val).name = ((CustomDialogPreset)this).Name;
val.msgID = "";
val.defaultOption = false;
val.useSuccessTest = false;
val.baseChance = 1f;
val.ranking = 1;
val.removeAfterSaying = false;
val.telephoneCallOption = true;
PhotoSelectDialog = photoSelectDialog;
aiSpeechPreset = new AISpeechPreset
{
dictionaryString = "Success",
ddsMessageID = "b6233341-7556-4b9d-a454-bf15eceac9e1",
isSuccessful = true,
chance = 1,
useParsing = true,
endsDialog = false
};
DialogController_OnDialogEnd.WatchedPresets[aiSpeechPreset.ddsMessageID] = delegate
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
HireAHitmanPlugin.PluginLogger.LogInfo((object)"Starting photo dialog");
DialogOption val2 = new DialogOption();
val2.preset = photoSelectDialog.Preset;
DialogController.Instance.ExecuteDialog(val2, Player.Instance.phoneInteractable, ((Actor)Player.Instance).currentNode, (Actor)(object)Player.Instance, (ForceSuccess)0, (InteractionDialogInstance)null);
HireAHitmanPlugin.PluginLogger.LogInfo((object)"Ending photo dialog");
};
val.responses.Add(aiSpeechPreset);
((CustomDialogPreset)this).Preset = val;
}
public override bool IsAvailable(DialogPreset preset, Citizen saysTo, SideJob jobRef)
{
return false;
}
public override void RunDialogMethod(DialogController instance, Citizen saysTo, Interactable saysToInteractable, NewNode where, Actor saidBy, bool success, NewRoom roomRef, SideJob jobRef)
{
}
public override ForceSuccess ShouldDialogSucceedOverride(DialogController instance, DialogOption dialog, Citizen saysTo, NewNode where, Actor saidBy)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ForceSuccess)1;
}
}
}