Decompiled source of QuestsOfAurai v1.0.0

plugins/QuestsOfAurai.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Windows.Forms;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CustomAttributes;
using HarmonyLib;
using NodeCanvas.DialogueTrees;
using NodeCanvas.Framework;
using QuestsOfAurai.Vendavel;
using SideLoader;
using SideLoader.Managers;
using SideLoader.Model;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("QuestsOfAurai")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuestsOfAurai")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace QuestsOfAurai
{
	public static class DialogueNPCs
	{
		public static void DialogueNPC_Setup(Character trainer, SL_Character currentCharacter, int quantity, string introDialogue, string ask1, string reply1, string ask2 = "", string reply2 = "", string ask3 = "", string reply3 = "", string ask4 = "", string reply4 = "", string ask5 = "", string reply5 = "")
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00a7: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00ce: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00f5: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_011c: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0143: Expected O, but got Unknown
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			Object.DestroyImmediate((Object)(object)((Component)trainer).GetComponent<CharacterStats>());
			Object.DestroyImmediate((Object)(object)((Component)trainer).GetComponent<StartingEquipment>());
			DialogueActor componentInChildren = ((Component)trainer).GetComponentInChildren<DialogueActor>();
			componentInChildren.SetName(currentCharacter.Name);
			Graph graph = ((GraphOwner)((Component)trainer).GetComponentInChildren<DialogueTreeController>()).graph;
			List<ActorParameter> actorParameters = ((DialogueTree)((graph is DialogueTree) ? graph : null))._actorParameters;
			actorParameters[0].actor = (IDialogueActor)(object)componentInChildren;
			actorParameters[0].name = componentInChildren.name;
			StatementNodeExt val = graph.AddNode<StatementNodeExt>();
			val.statement = new Statement(introDialogue);
			val.SetActorName(componentInChildren.name);
			MultipleChoiceNodeExt val2 = graph.AddNode<MultipleChoiceNodeExt>();
			val2.availableChoices.Add(new Choice
			{
				statement = new Statement
				{
					text = ask1
				}
			});
			if (quantity >= 2)
			{
				val2.availableChoices.Add(new Choice
				{
					statement = new Statement
					{
						text = ask2
					}
				});
			}
			if (quantity >= 3)
			{
				val2.availableChoices.Add(new Choice
				{
					statement = new Statement
					{
						text = ask3
					}
				});
			}
			if (quantity >= 4)
			{
				val2.availableChoices.Add(new Choice
				{
					statement = new Statement
					{
						text = ask4
					}
				});
			}
			if (quantity >= 5)
			{
				val2.availableChoices.Add(new Choice
				{
					statement = new Statement
					{
						text = ask5
					}
				});
			}
			StatementNodeExt val3 = null;
			StatementNodeExt val4 = null;
			StatementNodeExt val5 = null;
			StatementNodeExt val6 = null;
			StatementNodeExt val7 = null;
			val3 = graph.AddNode<StatementNodeExt>();
			val3.statement = new Statement(reply1);
			val3.SetActorName(componentInChildren.name);
			if (quantity >= 2)
			{
				val4 = graph.AddNode<StatementNodeExt>();
				val4.statement = new Statement(reply2);
				val4.SetActorName(componentInChildren.name);
			}
			if (quantity >= 3)
			{
				val5 = graph.AddNode<StatementNodeExt>();
				val5.statement = new Statement(reply3);
				val5.SetActorName(componentInChildren.name);
			}
			if (quantity >= 4)
			{
				val6 = graph.AddNode<StatementNodeExt>();
				val6.statement = new Statement(reply4);
				val6.SetActorName(componentInChildren.name);
			}
			if (quantity >= 5)
			{
				val7 = graph.AddNode<StatementNodeExt>();
				val7.statement = new Statement(reply5);
				val7.SetActorName(componentInChildren.name);
			}
			graph.allNodes.Clear();
			graph.allNodes.Add((Node)(object)val);
			graph.allNodes.Add((Node)(object)val3);
			graph.allNodes.Add((Node)(object)val2);
			if (quantity >= 2 && val4 != null)
			{
				graph.allNodes.Add((Node)(object)val4);
			}
			if (quantity >= 3 && val5 != null)
			{
				graph.allNodes.Add((Node)(object)val5);
			}
			if (quantity >= 4 && val6 != null)
			{
				graph.allNodes.Add((Node)(object)val6);
			}
			if (quantity >= 5 && val7 != null)
			{
				graph.allNodes.Add((Node)(object)val7);
			}
			graph.primeNode = (Node)(object)val;
			graph.ConnectNodes((Node)(object)val, (Node)(object)val2, -1, -1);
			graph.ConnectNodes((Node)(object)val2, (Node)(object)val3, 0, -1);
			graph.ConnectNodes((Node)(object)val3, (Node)(object)val, -1, -1);
			if (quantity >= 2 && val4 != null)
			{
				graph.ConnectNodes((Node)(object)val2, (Node)(object)val4, 1, -1);
				graph.ConnectNodes((Node)(object)val4, (Node)(object)val, -1, -1);
			}
			if (quantity >= 3 && val5 != null)
			{
				graph.ConnectNodes((Node)(object)val2, (Node)(object)val5, 2, -1);
				graph.ConnectNodes((Node)(object)val5, (Node)(object)val, -1, -1);
			}
			if (quantity >= 4 && val6 != null)
			{
				graph.ConnectNodes((Node)(object)val2, (Node)(object)val6, 3, -1);
				graph.ConnectNodes((Node)(object)val6, (Node)(object)val, -1, -1);
			}
			if (quantity >= 5 && val7 != null)
			{
				graph.ConnectNodes((Node)(object)val2, (Node)(object)val7, 4, -1);
				graph.ConnectNodes((Node)(object)val7, (Node)(object)val, -1, -1);
			}
			((Component)trainer).gameObject.SetActive(true);
		}
	}
	[BepInPlugin("iggy.quests.mod", "QuestsOfAurai", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(DT_QuestEventCheats), "OnClickNewQEEvent")]
		public class DT_QuestEventCheats_OnClickNewQEEvent
		{
			[HarmonyPostfix]
			public static void Postfix(string _eventUID, Button _item, BaseEventData _eventData)
			{
				Debug.Log((object)("UID: " + _eventUID));
				Clipboard.SetText(_eventUID);
			}
		}

		public const string GUID = "iggy.quests.mod";

		public const string NAME = "QuestsOfAurai";

		public const string VERSION = "1.0.0";

		internal static ManualLogSource Log;

		public static ConfigEntry<bool> ExampleConfig;

		public static Plugin Instance;

		internal void Awake()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			ExampleConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("ExampleCategory", "ExampleSetting", false, "This is an example setting.");
			SL.OnPacksLoaded += SL_OnPacksLoaded;
			VendavelQuest.Init();
			new Harmony("iggy.quests.mod").PatchAll();
			setCustomAttributes();
		}

		internal void Update()
		{
		}

		private void SL_OnPacksLoaded()
		{
			VendavelDialogues.Init();
			JoinVendavelEvents.Init();
		}

		internal void setCustomAttributes()
		{
			CustomAttributeHelper.PassiveCritRateStore(RewardIDs.betrayRewardID, BalancingVariables.betrayPassiveCrit);
		}
	}
	internal static class QuestHelpers
	{
		public static void ShowUIMessage(string message, float duration = 4f)
		{
			if (!((Object)(object)CharacterManager.Instance == (Object)null) && !string.IsNullOrEmpty(message))
			{
				Character firstLocalCharacter = CharacterManager.Instance.GetFirstLocalCharacter();
				if (Object.op_Implicit((Object)(object)firstLocalCharacter))
				{
					firstLocalCharacter.CharacterUI.NotificationPanel.ShowNotification(message, duration);
				}
			}
		}

		public static void ReloadLogs(int stack, QuestProgress progress, Dictionary<string, string> QuestLogSignatures)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			foreach (KeyValuePair<string, string> QuestLogSignature in QuestLogSignatures)
			{
				if (num < stack && QuestLogSignature.Key != null)
				{
					Debug.Log((object)("log: " + QuestLogSignature.Key));
					progress.UpdateLogEntry(progress.GetLogSignature(UID.op_Implicit(QuestLogSignature.Key)), displayTime: false);
					num++;
				}
			}
		}

		public static bool isActiveQuest(int QuestID)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Invalid comparison between Unknown and I4
			Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter();
			Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID(QuestID);
			QuestProgress component = ((Component)((itemFromItemID is Quest) ? itemFromItemID : null)).GetComponent<QuestProgress>();
			if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned(QuestID))
			{
				if ((int)component.m_progressState == 3 || (int)component.m_progressState == 4)
				{
					return false;
				}
				return true;
			}
			return false;
		}

		public static bool hasOrHadQuest(int QuestID)
		{
			if (((CharacterKnowledge)CharacterManager.Instance.GetWorldHostCharacter().Inventory.QuestKnowledge).IsItemLearned(QuestID))
			{
				return true;
			}
			return false;
		}
	}
	internal static class QuestExtensions
	{
		internal static void UpdateLogEntry(this QuestProgress progress, QuestLogEntrySignature signature, bool displayTime)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			progress.UpdateLogEntry(signature.UID, displayTime, signature);
		}
	}
	public static class QuestPackIDs
	{
		public static string MainPackID = "iggythemad QuestsOfAurai";

		public static string VendavelRecruitID = "iggy.questie.betrayer";

		public static string CierzoGuardID = "iggy.questie.cierzoGuard";
	}
	public static class QuestIDs
	{
		public static int vendavelQuestID = -2400;
	}
	public static class RewardIDs
	{
		public static int betrayRewardID = -2401;
	}
	public static class BalancingVariables
	{
		public static float betrayPassiveCrit = 5f;
	}
	public static class SpawnHelper
	{
		public static Character SpawnCharacter(string npcID, Vector3 npcPos, Vector3 npcRot)
		{
			//IL_0015: 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)
			return SL.GetSLPack(QuestPackIDs.MainPackID).CharacterTemplates[npcID].Spawn(npcPos, npcRot, UID.op_Implicit(UID.Generate()), (string)null);
		}
	}
	public static class VanillaQuestsHelper
	{
		public const int lookingToTheFutureQ = 7011002;

		public const int callToAdventureQ = 7011001;

		public const int enrollmentQ = 7011400;

		public const string playerInCierzo = "sm812Cio9ki5ssbsiPr3Fw";

		public const string tutorialIntroFinished = "HteYicnCK0atCgd4j5TV1Q";

		public const string introPlayerHouse = "z23QoIdtkU6cUPoUOfDn6w";

		public const string grandmother = "YQD53MKgwke6juWiSWI7jQ";

		public const string rissaBegExtension = "nt9KhXoJtkOalZ-wtfueDA";

		public const string rissaTalk = "n_3w-BcFfEW52Ht4Q3ZCjw";

		public const string debtPAID = "8GvHUbDz90OOJWurd-RZlg";

		public const string callToAdventureENDa = "g3EX5w1mwUaYW1o0cpj0SQ";

		public const string notLighthouseOwner = "-Ku9dHjTl0KeUPxWk0ZWWQ";

		public const string lostLightHouse = "qPEx275DTUSPbnv-PnFn7w";

		public const string debtNOTpaid = "sAc2Dj-T_kysKXFV48Hp0A";

		public const string callToAdventureENDb = "8iAJYhhqj02ODuwZ9VvXMw";

		public const string bergHouse = "g403vlCU6EG0s1mI6t_rFA";

		public const string harmattanHouse = "0r087PIxTUqoj6N7z2HFNw";

		public const string levantHouse = "LpVUuoxfhkaWOgh6XLbarA";

		public const string monsoonHouse = "shhCMFa-lUqbIYS9hRcsdg";

		public const int vendavelQ = 7011004;

		public const string cierzoDestroy = "lDHL_XMS7kKEs0uOqrLQjw";

		public const string cierzoWarning = "-vFSY-MNoUuLH1XXBkcqvQ";

		public const string cierzoTimer = "bm3rB3abI0KFok2x5P0lrg";

		public const string cierzoFail = "WvGjemEntk6quLjy4rLrJQ";

		public const string factionCommit = "bjVloYMQxk6KXx0gph2A1Q";

		public const string directionRISA = "seEIFfM9SkeZxc4CpR40oQ";

		public const string directionOLIELE = "Bo4-Xvq4_kudPDnOgkI3VA";

		public const string directionYSAN = "gAJAjuzl7ESFpMooq1oOCg";

		public const string olieleMonsoon = "3_soGcNagk-KcYSeqpEgMg";

		public const string yzanLevant = "BgpOoGQF10O7IQyiB9HODw";

		public const string rissaBerg = "1a6Zs9A_gEmScBetAraQaw";

		public const string readyToChoose = "jNfNsLGBpk2iMRts9kkerw";

		public const string BCproposition = "fo2uI7yiw0WSRE7MsbYFyw";

		public const string HKproposition = "JlFMC_51RUalSa8yLkhTmg";

		public const string HMproposition = "JqL0_JD55US2gL0-GbOBow";

		public const string argensonMet = "QMe_j2TIWEKpssXkLHMMZA";

		public const string argensonStash = "h8jI-dDsfkStb3XkCjqMPw";

		public const string YzanFriendship = "nr9KDCbQzUae1Gwf-6yOIQ";

		public const string callAdventureExpired = "zoKR1_bqiUiAetJ3uxw-Ug";

		public const string callAdventureCompleted = "ZYzrMi1skUiJ4BgXXQ3sfw";

		public const string hasFaction = "bjVloYMQxk6KXx0gph2A1Q";

		public const string isBlueChamber = "nllwi4FnR0qN7968EsJ07A";

		public const string isHeroicK = "SV3XUncnQU60ozhj9xTRpg";

		public const string isHolyM = "1tkTEWMPbEGKmWItwxy4kQ";

		public const string isSorobor = "TSqqSaAA-kekbG6ml8yQ6Q";

		public const string ashAllyFail = "nDy01eTHlUa_BPDlbIhZPQ";

		public const string ashCompleteFail = "f1JVZyhg2UiBA8xmC-w6Hw";

		public const string ashFight = "XqlcpbTJC0aTDZfjD4xCTg";

		public const string ashWarp = "oGkuUgWvfkej_El-rhz2gw";

		internal static void SkipHostToFactionChoice(bool keepHouse, bool complete)
		{
			Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter();
			worldHostCharacter.Inventory.QuestKnowledge.ReceiveQuest(7011001);
			worldHostCharacter.Inventory.QuestKnowledge.ReceiveQuest(7011002);
			((MonoBehaviour)Plugin.Instance).StartCoroutine(AddPrefactionEvents(keepHouse, complete));
		}

		internal static void DestroyCierzo(bool instant, bool receiveQ)
		{
			Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter();
			AddQuestEvent("-vFSY-MNoUuLH1XXBkcqvQ");
			AddQuestEvent("bm3rB3abI0KFok2x5P0lrg");
			if (receiveQ)
			{
				worldHostCharacter.Inventory.QuestKnowledge.ReceiveQuest(7011004);
			}
			if (instant)
			{
				AddQuestEvent("lDHL_XMS7kKEs0uOqrLQjw");
				AddQuestEvent("WvGjemEntk6quLjy4rLrJQ");
			}
		}

		internal static void AddQuestEvent(string questUID)
		{
			QuestEventManager.Instance.AddEvent(QuestEventDictionary.GetQuestEvent(questUID), 1);
		}

		internal static void RemoveEvent(string questUID)
		{
			QuestEventManager.Instance.RemoveEvent(questUID, true);
		}

		internal static IEnumerator AddPrefactionEvents(bool keepHouse, bool complete)
		{
			Character host = CharacterManager.Instance.GetWorldHostCharacter();
			yield return (object)new WaitForSeconds(0.1f);
			AddQuestEvent("sm812Cio9ki5ssbsiPr3Fw");
			AddQuestEvent("HteYicnCK0atCgd4j5TV1Q");
			AddQuestEvent("z23QoIdtkU6cUPoUOfDn6w");
			AddQuestEvent("nt9KhXoJtkOalZ-wtfueDA");
			AddQuestEvent("YQD53MKgwke6juWiSWI7jQ");
			AddQuestEvent("n_3w-BcFfEW52Ht4Q3ZCjw");
			if (keepHouse)
			{
				AddQuestEvent("8GvHUbDz90OOJWurd-RZlg");
				AddQuestEvent("g3EX5w1mwUaYW1o0cpj0SQ");
			}
			else
			{
				AddQuestEvent("-Ku9dHjTl0KeUPxWk0ZWWQ");
				AddQuestEvent("qPEx275DTUSPbnv-PnFn7w");
				AddQuestEvent("sAc2Dj-T_kysKXFV48Hp0A");
				AddQuestEvent("8iAJYhhqj02ODuwZ9VvXMw");
			}
			AddQuestEvent("seEIFfM9SkeZxc4CpR40oQ");
			AddQuestEvent("jNfNsLGBpk2iMRts9kkerw");
			AddQuestEvent("3_soGcNagk-KcYSeqpEgMg");
			AddQuestEvent("Bo4-Xvq4_kudPDnOgkI3VA");
			AddQuestEvent("JqL0_JD55US2gL0-GbOBow");
			AddQuestEvent("JlFMC_51RUalSa8yLkhTmg");
			AddQuestEvent("BgpOoGQF10O7IQyiB9HODw");
			AddQuestEvent("gAJAjuzl7ESFpMooq1oOCg");
			AddQuestEvent("QMe_j2TIWEKpssXkLHMMZA");
			AddQuestEvent("h8jI-dDsfkStb3XkCjqMPw");
			AddQuestEvent("nr9KDCbQzUae1Gwf-6yOIQ");
			AddQuestEvent("zoKR1_bqiUiAetJ3uxw-Ug");
			AddQuestEvent("ZYzrMi1skUiJ4BgXXQ3sfw");
			if (complete)
			{
				AddQuestEvent("fo2uI7yiw0WSRE7MsbYFyw");
				AddQuestEvent("1a6Zs9A_gEmScBetAraQaw");
				host.Inventory.QuestKnowledge.ReceiveQuest(7011400);
			}
		}

		internal static void StartHouseTimer()
		{
			CharacterManager.Instance.GetWorldHostCharacter().Inventory.QuestKnowledge.ReceiveQuest(7011001);
			((MonoBehaviour)Plugin.Instance).StartCoroutine(AddHouseTimerEvents());
		}

		private static IEnumerator AddHouseTimerEvents()
		{
			yield return (object)new WaitForSeconds(0.5f);
			AddQuestEvent("sm812Cio9ki5ssbsiPr3Fw");
			AddQuestEvent("HteYicnCK0atCgd4j5TV1Q");
			AddQuestEvent("z23QoIdtkU6cUPoUOfDn6w");
			AddQuestEvent("n_3w-BcFfEW52Ht4Q3ZCjw");
			AddQuestEvent("zoKR1_bqiUiAetJ3uxw-Ug");
		}
	}
	public class JoinVendavelRx : ActionNode
	{
		public static int ReadyToJoin;

		public override Status OnExecute(Component agent, IBlackboard bb)
		{
			Character value = bb.GetVariable<Character>("gInstigator").GetValue();
			if (SceneManagerHelper.ActiveSceneName == AreaManager.Instance.GetArea((AreaEnum)103).SceneName)
			{
				if (QuestEventManager.Instance.HasQuestEvent(QuestEventDictionary.GetQuestEvent("nllwi4FnR0qN7968EsJ07A")))
				{
					if (Object.op_Implicit((Object)(object)VendavelDialogues.VendavelRecruit))
					{
						Character vendavelRecruit = VendavelDialogues.VendavelRecruit;
						if (vendavelRecruit != null)
						{
							vendavelRecruit.SpellCastAnim((SpellCastType)900, (SpellCastModifier)2, 0);
						}
					}
					value.CharacterUI.ShowInfoNotification("Get away Blue Chamber scum!");
					value.CharacterUI.CloseAllMenus((MenuScreens[])null);
					value.Knock(true);
					return (Status)0;
				}
				if (Object.op_Implicit((Object)(object)value) && ReadyToJoin >= 2)
				{
					ReadyToJoin++;
					QuestHelpers.ShowUIMessage("Recruiter: We will depart soon", 6f);
					value.CharacterUI.ShowInfoNotification("Departing soon...");
					((MonoBehaviour)Plugin.Instance).StartCoroutine(JoinVendavelEvents.RaidCierzo());
					value.CharacterUI.CloseAllMenus((MenuScreens[])null);
					return (Status)1;
				}
				if (Object.op_Implicit((Object)(object)value) && ReadyToJoin == 1)
				{
					ReadyToJoin++;
					Character vendavelRecruit2 = VendavelDialogues.VendavelRecruit;
					if (vendavelRecruit2 != null)
					{
						vendavelRecruit2.SpellCastAnim((SpellCastType)900, (SpellCastModifier)2, 0);
					}
					value.CharacterUI.ShowInfoNotification("Completely sure? No regrets? Ask again.");
					value.CharacterUI.CloseAllMenus((MenuScreens[])null);
					value.Knock(true);
					return (Status)1;
				}
				if (Object.op_Implicit((Object)(object)value) && ReadyToJoin == 0)
				{
					ReadyToJoin++;
					Character vendavelRecruit3 = VendavelDialogues.VendavelRecruit;
					if (vendavelRecruit3 != null)
					{
						vendavelRecruit3.SpellCastAnim((SpellCastType)900, (SpellCastModifier)2, 0);
					}
					value.CharacterUI.ShowInfoNotification("You don't seem sure... Ask again.");
					value.CharacterUI.CloseAllMenus((MenuScreens[])null);
					value.Knock(true);
					return (Status)1;
				}
			}
			else if (SceneManagerHelper.ActiveSceneName == AreaManager.Instance.GetArea((AreaEnum)115).SceneName)
			{
				int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(VendavelQuest.QE_Vendavel_EventStack.EventUID);
				if (eventCurrentStack >= 7 && !((CharacterKnowledge)value.Inventory.SkillKnowledge).IsItemLearned(RewardIDs.betrayRewardID))
				{
					value.Inventory.ReceiveMoneyReward(100);
					value.Inventory.ReceiveSkillReward(RewardIDs.betrayRewardID);
					QuestHelpers.ShowUIMessage("Recruiter: Very well... now leave!");
					value.CharacterUI.CloseAllMenus((MenuScreens[])null);
					QuestEventManager.Instance.AddEvent(VendavelQuest.QE_Vendavel_EventStack, 1);
					Item itemFromItemID = ((CharacterKnowledge)CharacterManager.Instance.GetWorldHostCharacter().Inventory.QuestKnowledge).GetItemFromItemID(VendavelQuest.QuestID);
					VendavelQuest.UpdateQuestProgress((Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null));
				}
				else if (((CharacterKnowledge)value.Inventory.SkillKnowledge).IsItemLearned(RewardIDs.betrayRewardID))
				{
					Character vendavelRecruit4 = VendavelDialogues.VendavelRecruit;
					if (vendavelRecruit4 != null)
					{
						vendavelRecruit4.SpellCastAnim((SpellCastType)900, (SpellCastModifier)2, 0);
					}
					value.CharacterUI.ShowInfoNotification("You should leave...");
					value.CharacterUI.CloseAllMenus((MenuScreens[])null);
					value.Knock(true);
				}
				else if (eventCurrentStack <= 1)
				{
					QuestEventManager.Instance.AddEvent(VendavelQuest.QE_Vendavel_EventStack, 1);
					((MonoBehaviour)Plugin.Instance).StartCoroutine(JoinVendavelEvents.SpawnCierzoGuards());
					QuestHelpers.ShowUIMessage("Recruiter: Reinforcements incoming!", 6f);
					value.CharacterUI.ShowInfoNotification("Finish off the reinforcements!");
					value.CharacterUI.CloseAllMenus((MenuScreens[])null);
				}
				else
				{
					Character vendavelRecruit5 = VendavelDialogues.VendavelRecruit;
					if (vendavelRecruit5 != null)
					{
						vendavelRecruit5.SpellCastAnim((SpellCastType)900, (SpellCastModifier)2, 0);
					}
					value.CharacterUI.ShowInfoNotification("There's still stuff to do...");
					value.CharacterUI.CloseAllMenus((MenuScreens[])null);
					value.Knock(true);
				}
			}
			return (Status)0;
		}
	}
	public static class JoinVendavelEvents
	{
		public static Dictionary<Vector3, Vector3> guardPositions = new Dictionary<Vector3, Vector3>
		{
			{
				new Vector3(1379.2f, 6.4f, 1666.9f),
				new Vector3(0f, 268.4f, 0f)
			},
			{
				new Vector3(1423.1f, 6.5f, 1642.6f),
				new Vector3(0f, 34.6f, 0f)
			},
			{
				new Vector3(1336.6f, 29.6f, 1600f),
				new Vector3(0f, 137.8f, 0f)
			},
			{
				new Vector3(1287.7f, 13.8f, 1633.6f),
				new Vector3(0f, 251.4f, 0f)
			},
			{
				new Vector3(1244f, 26.1f, 1667.2f),
				new Vector3(0f, 353.1f, 0f)
			},
			{
				new Vector3(1307.6f, 12.4f, 1689.8f),
				new Vector3(0f, 197.5f, 0f)
			},
			{
				new Vector3(1343.1f, 12.2f, 1702f),
				new Vector3(0f, 173.4f, 0f)
			},
			{
				new Vector3(1326.1f, 6.2f, 1707.2f),
				new Vector3(0f, 4.7f, 0f)
			},
			{
				new Vector3(1338.2f, 6.6f, 1669f),
				new Vector3(0f, 96.5f, 0f)
			},
			{
				new Vector3(1450.2f, 5.4f, 1778.6f),
				new Vector3(0f, 166.6f, 0f)
			},
			{
				new Vector3(1370.2f, 5.8f, 1686.3f),
				new Vector3(0f, 7.7f, 0f)
			}
		};

		public static void Init()
		{
			SL.OnGameplayResumedAfterLoading += VendavelFriends;
		}

		public static IEnumerator RaidCierzo()
		{
			yield return (object)new WaitForSeconds(3f);
			VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true);
			BlackFade.Instance.StartFade(true);
			yield return (object)new WaitForSeconds(2f);
			BlackFade.Instance.StartFade(false);
			VanillaQuestsHelper.DestroyCierzo(instant: true, receiveQ: false);
			VendavelQuest.GetOrGiveQuestToHost();
			SL.OnGameplayResumedAfterLoading += VendavelFriends;
			NetworkLevelLoader.Instance.RequestSwitchArea(AreaManager.Instance.GetArea((AreaEnum)115).SceneName, 0, 1.5f, false);
		}

		private static void VendavelFriends()
		{
			//IL_0111: 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)
			if (SceneManagerHelper.ActiveSceneName == AreaManager.Instance.GetArea((AreaEnum)115).SceneName)
			{
				Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter();
				int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(VendavelQuest.QE_Vendavel_EventStack.EventUID);
				if (QuestHelpers.isActiveQuest(VendavelQuest.QuestID))
				{
					Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID(VendavelQuest.QuestID);
					VendavelQuest.UpdateQuestProgress((Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null));
					Debug.Log((object)"SWITCHING SIDES");
					Vector3 val = default(Vector3);
					Vector3 val2 = default(Vector3);
					foreach (PlayerSystem item in Global.Lobby.PlayersInLobby)
					{
						if (item.IsLocalPlayer)
						{
							item.ControlledCharacter.ChangeFaction((Factions)2, true);
							Debug.Log((object)("Faction: " + ((object)(Factions)(ref item.ControlledCharacter.Faction)).ToString()));
							((Vector3)(ref val))..ctor(1412.9f, 5.1f, 1714.7f);
							((Vector3)(ref val2))..ctor(0f, 243.8f, 0f);
							if (item.ControlledCharacter.Alive)
							{
								item.ControlledCharacter.Teleport(val, val2);
								item.ControlledCharacter.Knock(true);
							}
							item.ControlledCharacter.CharacterUI.ShowInfoNotification("You come back to your senses...");
						}
					}
					if (eventCurrentStack >= VendavelQuest.stacksToReinforce && eventCurrentStack <= VendavelQuest.stacksToAskComplete)
					{
						((MonoBehaviour)Plugin.Instance).StartCoroutine(SpawnCierzoGuards());
					}
				}
				else
				{
					SL.OnGameplayResumedAfterLoading -= VendavelFriends;
				}
				return;
			}
			foreach (PlayerSystem item2 in Global.Lobby.PlayersInLobby)
			{
				if (item2.IsLocalPlayer)
				{
					item2.ControlledCharacter.ChangeFaction((Factions)1, true);
				}
			}
			SL.OnGameplayResumedAfterLoading -= VendavelFriends;
		}

		public static IEnumerator SpawnCierzoGuards()
		{
			yield return (object)new WaitForSeconds(1f);
			Debug.Log((object)"SpawningGuards");
			string CierzoGuard = QuestPackIDs.CierzoGuardID;
			Vector3 npcPos = default(Vector3);
			((Vector3)(ref npcPos))..ctor(1367.6f, 7.1f, 1655f);
			Vector3 npcRot = default(Vector3);
			((Vector3)(ref npcRot))..ctor(0f, 340f, 0f);
			SpawnHelper.SpawnCharacter(CierzoGuard, npcPos, npcRot);
			foreach (Vector3 key in guardPositions.Keys)
			{
				Vector3 value = default(Vector3);
				guardPositions.TryGetValue(key, out value);
				SpawnHelper.SpawnCharacter(CierzoGuard, key, value);
				yield return (object)new WaitForSeconds(0.1f);
			}
		}
	}
	public static class VendavelDialogues
	{
		internal static SL_Character VendavelRecruiter;

		public static Character VendavelRecruit;

		public static void Init()
		{
			SL.GetSLPack(QuestPackIDs.MainPackID);
			SL.OnGameplayResumedAfterLoading += TrainerSpawn;
		}

		public static void VendavelRecruiterSettup(Character trainer, string _)
		{
			JoinVendavelNPCSetup(trainer, VendavelRecruiter, "What do you want? I got no time for... Wait a minute... You look promising. Yes. You should join us. I am Recruit Master Sonya. I'm hiring muscle for the upcoming raid on the town of Cierzo. Are you ready to abandon the Blue Chamber Collective and their silly lies?", "A raid? Why?", "Cierzo is just the first step to erradicate the Blue Chamber's lies. Nothing personal. They are just a stepping stone to further our goals.", "Is there consequences for joining?", "Besides the obvious you mean? You won't be able to be a part of the Blue Chamber anymore. Besides that... No. We will make sure there are no witnesses.", "I wish to join the raid!", "Very well then.");
		}

		public static void VendavelEndSettup(Character trainer, string _)
		{
			JoinVendavelNPCSetup(trainer, VendavelRecruiter, "Not bad... Not bad... You did well. Once we finish cleaning up, take anything you want and our business shall be completed.", "What happened? I don't remember", "Funny. You were a beast out there. We just gave you some `enhancers` but it seems that the mix of them, plus your hatred for these people made you go berserk.", "How do I get out of here?", "By the storage. The main entrance is still barricated. But I don't guarantee your safety once  our business is concluded. Die well.", "Cierzo is taken. Where's my reward?.", "Very well then.");
		}

		private static void TrainerSpawn()
		{
			if (CharacterManager.Instance.GetWorldHostCharacter().IsLocalPlayer)
			{
				((MonoBehaviour)Plugin.Instance).StartCoroutine(delayedTrainerSpawn());
				VendavelRecruiter = SL.GetSLPack(QuestPackIDs.MainPackID).CharacterTemplates[QuestPackIDs.VendavelRecruitID];
				if (SceneManagerHelper.ActiveSceneName == AreaManager.Instance.GetArea((AreaEnum)103).SceneName)
				{
					VendavelRecruiter.OnSpawn += VendavelRecruiterSettup;
				}
				else if (SceneManagerHelper.ActiveSceneName == AreaManager.Instance.GetArea((AreaEnum)115).SceneName)
				{
					VendavelRecruiter.OnSpawn += VendavelEndSettup;
				}
			}
		}

		public static IEnumerator delayedTrainerSpawn()
		{
			Debug.Log((object)"SPAWN COROUTINE");
			yield return (object)new WaitForSeconds(1f);
			Vector3 npcPos = default(Vector3);
			Vector3 npcRot = default(Vector3);
			if (SceneManagerHelper.ActiveSceneName == "Chersonese_Dungeon1")
			{
				if (!QuestEventManager.Instance.HasQuestEvent(QuestEventDictionary.GetQuestEvent("lDHL_XMS7kKEs0uOqrLQjw")))
				{
					((Vector3)(ref npcPos))..ctor(3.44f, 0.03f, 12.88f);
					((Vector3)(ref npcRot))..ctor(0f, 217.71f, 0f);
					VendavelRecruit = SpawnHelper.SpawnCharacter(QuestPackIDs.VendavelRecruitID, npcPos, npcRot);
				}
			}
			else if (SceneManagerHelper.ActiveSceneName == AreaManager.Instance.GetArea((AreaEnum)115).SceneName && QuestHelpers.isActiveQuest(VendavelQuest.QuestID))
			{
				((Vector3)(ref npcPos))..ctor(1411.6f, 5.1f, 1709.5f);
				((Vector3)(ref npcRot))..ctor(0f, 302.5f, 0f);
				VendavelRecruit = SpawnHelper.SpawnCharacter(QuestPackIDs.VendavelRecruitID, npcPos, npcRot);
			}
		}

		public static void JoinVendavelNPCSetup(Character trainer, SL_Character currentCharacter, string introDialogue, string ask1, string reply1, string ask2, string reply2, string askJoin, string replyJoin)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00a5: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00c8: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00eb: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			Object.DestroyImmediate((Object)(object)((Component)trainer).GetComponent<CharacterStats>());
			Object.DestroyImmediate((Object)(object)((Component)trainer).GetComponent<StartingEquipment>());
			DialogueActor componentInChildren = ((Component)trainer).GetComponentInChildren<DialogueActor>();
			componentInChildren.SetName(currentCharacter.Name);
			Graph graph = ((GraphOwner)((Component)trainer).GetComponentInChildren<DialogueTreeController>()).graph;
			List<ActorParameter> actorParameters = ((DialogueTree)((graph is DialogueTree) ? graph : null))._actorParameters;
			actorParameters[0].actor = (IDialogueActor)(object)componentInChildren;
			actorParameters[0].name = componentInChildren.name;
			StatementNodeExt val = graph.AddNode<StatementNodeExt>();
			val.statement = new Statement(introDialogue);
			val.SetActorName(componentInChildren.name);
			MultipleChoiceNodeExt val2 = graph.AddNode<MultipleChoiceNodeExt>();
			val2.availableChoices.Add(new Choice
			{
				statement = new Statement
				{
					text = ask1
				}
			});
			val2.availableChoices.Add(new Choice
			{
				statement = new Statement
				{
					text = ask2
				}
			});
			val2.availableChoices.Add(new Choice
			{
				statement = new Statement
				{
					text = askJoin
				}
			});
			StatementNodeExt val3 = null;
			StatementNodeExt val4 = null;
			JoinVendavelRx joinVendavelRx = new JoinVendavelRx();
			val3 = graph.AddNode<StatementNodeExt>();
			val3.statement = new Statement(reply1);
			val3.SetActorName(componentInChildren.name);
			val4 = graph.AddNode<StatementNodeExt>();
			val4.statement = new Statement(reply2);
			val4.SetActorName(componentInChildren.name);
			StatementNodeExt obj = graph.AddNode<StatementNodeExt>();
			obj.statement = new Statement(replyJoin);
			obj.SetActorName(componentInChildren.name);
			graph.allNodes.Clear();
			graph.allNodes.Add((Node)(object)val);
			graph.allNodes.Add((Node)(object)val2);
			graph.allNodes.Add((Node)(object)val3);
			graph.allNodes.Add((Node)(object)val4);
			graph.allNodes.Add((Node)(object)joinVendavelRx);
			graph.primeNode = (Node)(object)val;
			graph.ConnectNodes((Node)(object)val, (Node)(object)val2, -1, -1);
			graph.ConnectNodes((Node)(object)val2, (Node)(object)val3, 0, -1);
			graph.ConnectNodes((Node)(object)val3, (Node)(object)val, -1, -1);
			graph.ConnectNodes((Node)(object)val2, (Node)(object)val4, 1, -1);
			graph.ConnectNodes((Node)(object)val4, (Node)(object)val, -1, -1);
			graph.ConnectNodes((Node)(object)val2, (Node)(object)joinVendavelRx, 2, -1);
			graph.ConnectNodes((Node)(object)joinVendavelRx, (Node)(object)val, -1, -1);
			((Component)trainer).gameObject.SetActive(true);
		}
	}
	public static class PreventBlueJoin
	{
		[HarmonyPatch(typeof(InteractionTriggerBase), "TryActivateBasicAction", new Type[]
		{
			typeof(Character),
			typeof(int)
		})]
		public class InteractionTriggerBase_TryActivateBasicAction
		{
			[HarmonyPrefix]
			public static bool Prefix(InteractionTriggerBase __instance, Character _character, int _toggleState)
			{
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)_character) || !_character.IsLocalPlayer)
				{
					return true;
				}
				EventActivator currentTriggerManager = __instance.CurrentTriggerManager;
				if (Object.op_Implicit((Object)(object)((currentTriggerManager is InteractionActivator) ? currentTriggerManager : null)))
				{
					EventActivator currentTriggerManager2 = __instance.CurrentTriggerManager;
					InteractionActivator val = (InteractionActivator)(object)((currentTriggerManager2 is InteractionActivator) ? currentTriggerManager2 : null);
					if (val.BasicInteraction != null)
					{
						_ = val.BasicInteraction;
						if (SceneManagerHelper.ActiveSceneName == "Berg")
						{
							Debug.Log((object)"SPEAKIN TO RIZA");
							if (Vector3.Distance(((Component)_character).transform.position, rizaPosition) < 2.5f && QuestHelpers.hasOrHadQuest(VendavelQuest.QuestID))
							{
								_character.CharacterUI.ShowInfoNotification("She won't speak to you                     anymore...");
								return false;
							}
						}
					}
				}
				return true;
			}
		}

		private static Vector3 rizaPosition = new Vector3(1272.8f, -13f, 1490.8f);
	}
}
namespace QuestsOfAurai.Vendavel
{
	public static class VendavelQuest
	{
		[HarmonyPatch(typeof(Character), "Die")]
		public class Character_Die
		{
			[HarmonyPostfix]
			public static void Postfix(Character __instance, Vector3 _hitVec, bool _loadedDead = false)
			{
				if (SceneManagerHelper.ActiveSceneName == AreaManager.Instance.GetArea((AreaEnum)115).SceneName && __instance.IsAI && __instance.Name == "Cierzo Guard")
				{
					int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_Vendavel_EventStack.EventUID);
					if (eventCurrentStack < stacksToAskComplete && eventCurrentStack >= stacksToReinforce)
					{
						Item itemFromItemID = ((CharacterKnowledge)CharacterManager.Instance.GetWorldHostCharacter().Inventory.QuestKnowledge).GetItemFromItemID(QuestID);
						Item quest = ((itemFromItemID is Quest) ? itemFromItemID : null);
						QuestEventManager.Instance.AddEvent(QE_Vendavel_EventStack, 1);
						UpdateQuestProgress((Quest)(object)quest);
					}
				}
			}
		}

		public static int QuestID = QuestIDs.vendavelQuestID;

		private const string QuestName = "Abandon the Blue";

		public const string QUEST_EVENT_FAMILY_NAME = "Iggy_Questie_Vendavel";

		private const string LogSignature_A = "questie.vendavel.objective.a";

		private const string LogSignature_B = "questie.vendavel.objective.b";

		private const string LogSignature_C = "questie.vendavel.objective.c";

		private const string LogSignature_D = "questie.vendavel.objective.d";

		public static QuestEventSignature QE_Vendavel_EventStack;

		public static int stacksToAskComplete = 8;

		public static int stacksToReinforce = 2;

		public static string QE_Scenario_UID => "iggy.questie.vendavel";

		public static SL_Quest QuestTemplate { get; private set; }

		public static Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string>
		{
			{ "questie.vendavel.objective.a", "Speak to the Vendavel Recruiter." },
			{ "questie.vendavel.objective.b", "Return to the fight. Finish off the reinforcements!." },
			{ "questie.vendavel.objective.c", "Report to the Vendavel Recruiter. Claim your reward." },
			{ "questie.vendavel.objective.d", "The vendavel has no more business with you. Leave." }
		};

		public static void Init()
		{
			SL.OnPacksLoaded += OnPacksLoaded;
			QE_Vendavel_EventStack = CustomQuests.CreateQuestEvent("questie.vendavel.start", false, true, true, "Iggy_Questie_Vendavel", "CustomEvent", "A custom event created with SideLoader");
			SL.OnGameplayResumedAfterLoading += AfterLoad;
		}

		private static void OnPacksLoaded()
		{
			PrepareSLQuest();
		}

		private static void AfterLoad()
		{
			if (PhotonNetwork.isNonMasterClientInRoom)
			{
				return;
			}
			Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter();
			if (SceneManagerHelper.ActiveSceneName == AreaManager.Instance.GetArea((AreaEnum)115).SceneName)
			{
				if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned(QuestID))
				{
					Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID(QuestID);
					UpdateQuestProgress((Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null));
				}
				else
				{
					SL.OnGameplayResumedAfterLoading -= AfterLoad;
				}
				return;
			}
			Item itemFromItemID2 = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID(QuestID);
			QuestProgress component = ((Component)((itemFromItemID2 is Quest) ? itemFromItemID2 : null)).GetComponent<QuestProgress>();
			if (QuestHelpers.isActiveQuest(QuestID))
			{
				worldHostCharacter.CharacterUI.ShowInfoNotification("You serve no purpose to the Vendavel anymore.");
				component.DisableQuest((ProgressState)4);
				SL.OnGameplayResumedAfterLoading -= AfterLoad;
			}
		}

		public static Quest GetOrGiveQuestToHost()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Getting Vendavel Quest...");
			Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter();
			if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned(QuestID))
			{
				Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID(QuestID);
				return (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null);
			}
			Item obj = ItemManager.Instance.GenerateItemNetwork(QuestID);
			Quest val = (Quest)(object)((obj is Quest) ? obj : null);
			((Component)val).transform.SetParent(((Component)worldHostCharacter.Inventory.QuestKnowledge).transform);
			((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).AddItem((Item)(object)val);
			((Component)val).GetComponent<QuestProgress>().m_progressState = (ProgressState)1;
			if (QuestEventManager.Instance.GetEventCurrentStack(QE_Vendavel_EventStack.EventUID) <= 0)
			{
				QuestEventManager.Instance.AddEvent(QE_Vendavel_EventStack, 1);
			}
			UpdateQuestProgress(val);
			QuestTemplate.OnQuestLoaded += UpdateQuestProgress;
			return val;
		}

		private static void PrepareSLQuest()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			SL_Quest val = new SL_Quest();
			((SL_Item)val).Target_ItemID = 7011620;
			((SL_Item)val).New_ItemID = QuestID;
			((SL_Item)val).Name = "Abandon the Blue";
			val.IsSideQuest = false;
			((SL_Item)val).ItemExtensions = (SL_ItemExtension[])(object)new SL_ItemExtension[1] { (SL_ItemExtension)new SL_QuestProgress() };
			QuestTemplate = val;
			List<SL_QuestLogEntrySignature> list = new List<SL_QuestLogEntrySignature>();
			foreach (KeyValuePair<string, string> questLogSignature in QuestLogSignatures)
			{
				list.Add(new SL_QuestLogEntrySignature
				{
					UID = questLogSignature.Key,
					Text = questLogSignature.Value,
					Type = (QuestLogEntrySignatureType)0
				});
			}
			SL_ItemExtension obj = ((SL_Item)QuestTemplate).ItemExtensions[0];
			((SL_QuestProgress)((obj is SL_QuestProgress) ? obj : null)).LogSignatures = list.ToArray();
			((ContentTemplate)QuestTemplate).ApplyTemplate();
			QuestTemplate.OnQuestLoaded += UpdateQuestProgress;
		}

		public static void UpdateQuestProgress(Quest quest)
		{
			//IL_0051: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			if (PhotonNetwork.isNonMasterClientInRoom)
			{
				return;
			}
			QuestProgress component = ((Component)quest).GetComponent<QuestProgress>();
			if (!QuestHelpers.isActiveQuest(QuestID))
			{
				QuestTemplate.OnQuestLoaded -= UpdateQuestProgress;
				return;
			}
			int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_Vendavel_EventStack.EventUID);
			if (eventCurrentStack == 1)
			{
				QuestLogEntrySignature logSignature = component.GetLogSignature(UID.op_Implicit("questie.vendavel.objective.a"));
				component.UpdateLogEntry(logSignature, displayTime: false);
				QuestHelpers.ShowUIMessage("Recruiter: You are alive afterall?", 6f);
			}
			else if (eventCurrentStack >= stacksToReinforce && eventCurrentStack <= stacksToAskComplete)
			{
				QuestLogEntrySignature logSignature2 = component.GetLogSignature(UID.op_Implicit("questie.vendavel.objective.b"));
				component.UpdateLogEntry(logSignature2, displayTime: false);
				QuestHelpers.ShowUIMessage("Kill Guards: " + (eventCurrentStack - 2) + "/6");
			}
			if (eventCurrentStack == stacksToAskComplete)
			{
				QuestHelpers.ShowUIMessage("Recruiter: Cierzo is ours! To me!", 6f);
				QuestLogEntrySignature logSignature3 = component.GetLogSignature(UID.op_Implicit("questie.vendavel.objective.c"));
				component.UpdateLogEntry(logSignature3, displayTime: false);
			}
			else if (eventCurrentStack >= 9)
			{
				QuestLogEntrySignature logSignature4 = component.GetLogSignature(UID.op_Implicit("questie.vendavel.objective.d"));
				component.UpdateLogEntry(logSignature4, displayTime: true);
				component.DisableQuest((ProgressState)3);
			}
			component = quest.m_questProgress;
		}
	}
}