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.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HG; using HG.Reflection; using IL.RoR2.UI; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using RoR2BepInExPack.GameAssetPaths.Version_1_35_0; using ShaderSwapper; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using questshrine.bases; using questshrine.content.componentns; [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyCompany("questshrine")] [assembly: AssemblyProduct("questshrine")] [assembly: AssemblyTitle("questshrine")] [assembly: AssemblyInformationalVersion("1.0.0+0a2ad724f155a843dbfc84f3fb31243d55e1cd84")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [Embedded] [CompilerGenerated] [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 questshrine { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInPlugin("kina.questshrine", "questshrine", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class questshrine : BaseUnityPlugin { private const string PluginGUID = "kina.questshrine"; private const string PluginAuthor = "kina"; private const string PluginName = "questshrine"; private const string PluginVersion = "0.1.0"; public static questshrine instance; public static AssetBundle bundle; private static Material shrineMat = Addressables.LoadAssetAsync((object)RoR2_Base_ShrineBlood.matShrineBlood_mat).WaitForCompletion(); private static GameObject notifPrefab; public readonly Dictionary questObjectCatalog = new Dictionary(); private static bool UHRInstalled => Chainloader.PluginInfos.ContainsKey("iDeathHD.UnityHotReload"); public void Awake() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); instance = this; bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "questshrinebundle")); ((MonoBehaviour)this).StartCoroutine(ShaderSwapper.UpgradeStubbedShadersAsync(bundle)); LoadBases(); LoadShrine(); notifPrefab = bundle.LoadAsset("NotificationPanel2"); NotificationUIController.SetUpNotification += new Manipulator(AddCustomNotificationIL); } public void AddCustomNotificationIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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) ILCursor val = new ILCursor(il); try { if (val.TryGotoNext(new Func[5] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "Instantiate"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "GetComponent"), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "currentNotification") })) { Log.Debug("matched !! yayy"); int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.Emit(OpCodes.Ldloc_S, (byte)0); val.EmitDelegate>((Func)delegate(NotificationUIController notifUIControl, NotificationInfo notifInfo, GameObject prevNotifPrefab) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (notifInfo?.transformation?.transformationType != (TransformationType?)QuestBehaviorBase.notificationEnum) { return prevNotifPrefab; } notifUIControl.LowerPricedChestsRegenTransformationNotificationPrefab = notifPrefab; return notifPrefab; }); val.Emit(OpCodes.Stloc_0); val.Index += 4; val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, typeof(NotificationUIController).GetField("currentNotification", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.GetProperty)); val.EmitDelegate>((Action)delegate(NotificationUIController notifUIControl, NotificationInfo notifInfo, GenericNotification genericNotif) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (notifInfo?.transformation?.transformationType == (TransformationType?)QuestBehaviorBase.notificationEnum) { QuestBase questBase = notifInfo.data as QuestBase; genericNotif.titleText.token = Language.GetString(questBase.QuestTitle); genericNotif.descriptionText.token = Language.GetString(questBase.QuestDesc); genericNotif.iconImage.texture = (Texture)(object)questBase.QuestIcon.texture; } }); } else { Log.Error("fuck !!!!!!!!!!!!!!! couldnt match notifictation il .,. dlc4 probablys idk.,,..,"); QuestBehaviorBase.notificationEnum = 0; } } catch (Exception data) { Log.Error("error while il patching notifiction ! dlc4 probably killed me,.,."); Log.Error(data); QuestBehaviorBase.notificationEnum = 0; } } private void LoadBases() { foreach (Type item in from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(QuestBase)) select type) { QuestBase questBase = (QuestBase)Activator.CreateInstance(item); questBase.Init(((BaseUnityPlugin)this).Config); if (questBase.enabled) { GameObject val = PrefabAPI.CreateEmptyPrefab("quest prefab " + questBase.QuestName, true); val.AddComponent(questBase.Behavior); questObjectCatalog.Add(questBase, val); } } } private void LoadShrine() { //IL_007d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0097: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown GameObject obj = bundle.LoadAsset("questshrineprefab"); ((Renderer)((Component)obj.transform.Find("chanceshrine").Find("shrine")).GetComponent()).material = shrineMat; QuestShrineComponent questShrineComponent = obj.AddComponent(); PurchaseInteraction component = obj.GetComponent(); questShrineComponent.purchaseInteraction = component; ConfigEntry val = ((BaseUnityPlugin)instance).Config.Bind("Quest Shrine", "Shrine selection weight", 3, "selection weight of how common quest shrine should spawn .,., for reference mountain shrines are usually weight of 1 ,., chance a weight of 2 .,,. and combat a weight of 3 ,..,"); InteractableSpawnCard spawnCard = bundle.LoadAsset("questshrineisc"); DirectorCard card = new DirectorCard { selectionWeight = val.Value, spawnCard = (SpawnCard)(object)spawnCard }; Helpers.AddNewInteractable(new DirectorCardHolder { Card = card, InteractableCategory = (InteractableCategory)4 }); ContentAddition.AddNetworkedObject(obj); } private void Update() { } } public static class Utils { private static List addedConfigs = new List(); public static void SliderConfig(float min, float max, ConfigEntry config) { //IL_0000: 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) //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_001f: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown StepSliderConfig val = new StepSliderConfig { max = max, min = min, FormatString = "{0:0}" }; ModSettingsManager.AddOption((BaseOption)new StepSliderOption(config, val)); } public static ConfigEntry SliderConfig(ConfigEntry config, int min = -1, int max = -1) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown if (addedConfigs.Contains(((ConfigEntryBase)config).Definition.Key)) { return config; } addedConfigs.Add(((ConfigEntryBase)config).Definition.Key); if (min == -1) { min = (int)((ConfigEntryBase)config).DefaultValue / 2; } if (max == -1) { max = (int)((ConfigEntryBase)config).DefaultValue * 2; } IntSliderConfig val = new IntSliderConfig { max = max, min = min, formatString = "{0:0}" }; ModSettingsManager.AddOption((BaseOption)new IntSliderOption(config, val)); return config; } public static ConfigEntry CheckboxConfig(ConfigEntry config, bool restartRequired = false) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown if (addedConfigs.Contains(((ConfigEntryBase)config).Definition.Key)) { return config; } addedConfigs.Add(((ConfigEntryBase)config).Definition.Key); CheckBoxConfig val = new CheckBoxConfig(); ((BaseOptionConfig)val).restartRequired = restartRequired; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(config, val)); return config; } public static void StringConfig(ConfigEntry config) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown InputFieldConfig val = new InputFieldConfig(); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(config, val)); } public static void KeyboardConfig(ConfigEntry config) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown KeyBindConfig val = new KeyBindConfig(); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(config, val)); } } } namespace questshrine.content.quests { public class DisableSkills : QuestBase { public static ConfigEntry minTimer; public static ConfigEntry maxTimer; public override string QuestName => "Disable Skills"; public override string QuestTitle => "the planet sent out a freakings emp .,,.."; public override string QuestDesc => "skills disabled for {0} seconds,.,."; public override string QuestDescRetired => "skills no longer disabled!!!"; public override Sprite QuestIcon => questshrine.bundle.LoadAsset("noskills"); public override string[] Tags => new string[1] { "noStack" }; public override Type Behavior => typeof(DisableSkillsBehaviorBase); public override void CreateConfig(ConfigFile config) { minTimer = Utils.SliderConfig(ConfigHelper("min timer value", 10, "minimum timer value for skills being disabled .,,.")); maxTimer = Utils.SliderConfig(ConfigHelper("max timer value", 25, "max timer value for skills being disabled .,,.")); } } public class DisableSkillsBehaviorBase : QuestBehaviorBase { [SyncVar] public float timer; [SyncVar] public float startingTime; public bool gaveReward; public override QuestBase QuestBase => QuestBase.instance; public override Type ObjectiveType => typeof(NoSkillsObjective); public float Networktimer { get { return timer; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref timer, 4u); } } public float NetworkstartingTime { get { return startingTime; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref startingTime, 8u); } } public override void StartQuest() { if (!NetworkServer.active) { base.StartQuest(); DisableSkillsForBody(base.body); return; } NetworkstartingTime = Run.instance.runRNG.RangeFloat((float)DisableSkills.minTimer.Value, (float)DisableSkills.maxTimer.Value) - 0.75f; Networktimer = startingTime + 2f; DisableSkillsForBody(base.body); charMaster.onBodyStart += DisableSkillsForBody; base.NetworkQuestDescInternal = string.Format(QuestBase.instance.QuestDesc, startingTime.ToString("0")); base.StartQuest(); } public void DisableSkillsForBody(CharacterBody charBody) { if (Object.op_Implicit((Object)(object)base.body.skillLocator)) { if (Object.op_Implicit((Object)(object)base.body.skillLocator.primary)) { base.body.skillLocator.primary.SetSkillOverride((object)this, CommonAssets.disabledSkill, (SkillOverridePriority)4); } if (Object.op_Implicit((Object)(object)base.body.skillLocator.secondary)) { base.body.skillLocator.secondary.SetSkillOverride((object)this, CommonAssets.disabledSkill, (SkillOverridePriority)4); } if (Object.op_Implicit((Object)(object)base.body.skillLocator.utility)) { base.body.skillLocator.utility.SetSkillOverride((object)this, CommonAssets.disabledSkill, (SkillOverridePriority)4); } if (Object.op_Implicit((Object)(object)base.body.skillLocator.special)) { base.body.skillLocator.special.SetSkillOverride((object)this, CommonAssets.disabledSkill, (SkillOverridePriority)4); } } } public override void OnDisable() { charMaster.onBodyStart -= DisableSkillsForBody; if (Object.op_Implicit((Object)(object)base.body.skillLocator)) { if (Object.op_Implicit((Object)(object)base.body.skillLocator.primary)) { base.body.skillLocator.primary.UnsetSkillOverride((object)this, CommonAssets.disabledSkill, (SkillOverridePriority)4); } if (Object.op_Implicit((Object)(object)base.body.skillLocator.secondary)) { base.body.skillLocator.secondary.UnsetSkillOverride((object)this, CommonAssets.disabledSkill, (SkillOverridePriority)4); } if (Object.op_Implicit((Object)(object)base.body.skillLocator.utility)) { base.body.skillLocator.utility.UnsetSkillOverride((object)this, CommonAssets.disabledSkill, (SkillOverridePriority)4); } if (Object.op_Implicit((Object)(object)base.body.skillLocator.special)) { base.body.skillLocator.special.UnsetSkillOverride((object)this, CommonAssets.disabledSkill, (SkillOverridePriority)4); } } base.OnDisable(); } public void FixedUpdate() { if (NetworkServer.active) { Networktimer = timer - Time.fixedDeltaTime; if ((double)timer < 0.5 && !gaveReward) { gaveReward = true; QuestBase.instance.GiveReward(base.body); base.CallRpcRetire(); } } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool flag = base.OnSerialize(writer, forceAll); if (forceAll) { writer.Write(timer); writer.Write(startingTime); return true; } bool flag2 = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & 4) != 0) { if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag2 = true; } writer.Write(timer); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8) != 0) { if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag2 = true; } writer.Write(startingTime); } if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag2 || flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { base.OnDeserialize(reader, initialState); if (initialState) { timer = reader.ReadSingle(); startingTime = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if ((num & 4) != 0) { timer = reader.ReadSingle(); } if ((num & 8) != 0) { startingTime = reader.ReadSingle(); } } } public class NoSkillsObjective : QuestObjectiveBase { private DisableSkillsBehaviorBase _disableSkillsQuest; public override string GenerateString() { if (!Object.op_Implicit((Object)(object)_disableSkillsQuest)) { _disableSkillsQuest = (DisableSkillsBehaviorBase)(object)((ObjectiveTracker)this).sourceDescriptor.source; questBehavior = _disableSkillsQuest; } string text = string.Format(QuestBase.instance.QuestDesc, _disableSkillsQuest.timer.ToString("0")); if (!((Behaviour)_disableSkillsQuest).enabled) { ((ObjectiveTracker)this).retired = true; text = QuestBase.instance.QuestDescRetired; Object.Destroy((Object)(object)_disableSkillsQuest); } return GetPlayerName() + text; } public override bool IsDirty() { return true; } } public class KillEnemies : QuestBase { public override string QuestName => "Kill Enemies"; public override string QuestTitle => "the planet's malice grows .,,.."; public override string QuestDesc => "kill {0} {1}{2},.,."; public override string QuestDescRetired => "killed {0} {1}{2}!!!"; public override Sprite QuestIcon => questshrine.bundle.LoadAsset("killenemies"); public override bool useListeners => true; public override Type Behavior => typeof(KillEnemiesBehaviorBase); public override void CreateConfig(ConfigFile config) { } } public class KillEnemiesBehaviorBase : QuestBehaviorBase { [SyncVar] public int bodyIndex; [SyncVar] public int killAmount; [SyncVar] public int startingKillAmount; public override QuestBase QuestBase => QuestBase.instance; public override Type ObjectiveType => typeof(KillEnemiesObjective); public int NetworkbodyIndex { get { return bodyIndex; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref bodyIndex, 4u); } } public int NetworkkillAmount { get { return killAmount; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref killAmount, 8u); } } public int NetworkstartingKillAmount { get { return startingKillAmount; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref startingKillAmount, 16u); } } public override void StartQuest() { //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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_01ab: Expected I4, but got Unknown //IL_01b9: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { base.StartQuest(); return; } KilledOtherServer = (Action)Delegate.Combine(KilledOtherServer, new Action(OnKilledOtherServer)); ClassicStageInfo component = GameObject.Find("SceneInfo").GetComponent(); List> list = new List>(); List list2 = new List(); ChoiceInfo[] choices = component.monsterSelection.choices; CharacterMaster val = default(CharacterMaster); for (int i = 0; i < choices.Length; i++) { ChoiceInfo item = choices[i]; if (item.value?.minimumStageCompletions > Run.instance.stageClearCount) { continue; } DirectorCard value = item.value; if (value != null) { SpawnCard spawnCard = value.spawnCard; bool? obj; if (spawnCard == null) { obj = null; } else { GameObject prefab = spawnCard.prefab; obj = ((prefab != null) ? new bool?(prefab.TryGetComponent(ref val)) : ((bool?)null)); } bool? flag = obj; if (flag == true && !val.bodyPrefab.GetComponent().isChampion && item.value.cost <= 100) { list.Add(item); list2.Add(val); } } } WeightedSelection val2 = new WeightedSelection(8); for (int j = 0; j < list.Count; j++) { val2.AddChoice(list2[j], (float)list[j].value.cost); } CharacterMaster val3 = val2.Evaluate(Run.instance.runRNG.nextNormalizedFloat); NetworkbodyIndex = (int)BodyCatalog.FindBodyIndex(val3.bodyPrefab); NetworkkillAmount = (int)(50f / (float)list[list2.IndexOf(val3)].value.cost * Run.instance.runRNG.RangeFloat(1f, 2f)); if (killAmount <= 3) { NetworkkillAmount = killAmount + 2; } NetworkstartingKillAmount = killAmount; base.NetworkQuestDescInternal = string.Format(QuestBase.instance.QuestDesc, killAmount, Language.GetString(BodyCatalog.GetBodyPrefab((BodyIndex)bodyIndex).GetComponent().baseNameToken), (killAmount > 1) ? "s" : ""); base.StartQuest(); } public void OnKilledOtherServer(DamageReport damageReport) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)damageReport.victimBodyIndex == bodyIndex) { NetworkkillAmount = killAmount - 1; if (killAmount == 0) { QuestBase.instance.GiveReward(base.body); base.CallRpcRetire(); } } } public override void OnDisable() { KilledOtherServer = (Action)Delegate.Combine(KilledOtherServer, new Action(OnKilledOtherServer)); base.OnDisable(); } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool flag = base.OnSerialize(writer, forceAll); if (forceAll) { writer.WritePackedUInt32((uint)bodyIndex); writer.WritePackedUInt32((uint)killAmount); writer.WritePackedUInt32((uint)startingKillAmount); return true; } bool flag2 = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & 4) != 0) { if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag2 = true; } writer.WritePackedUInt32((uint)bodyIndex); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8) != 0) { if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag2 = true; } writer.WritePackedUInt32((uint)killAmount); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x10) != 0) { if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag2 = true; } writer.WritePackedUInt32((uint)startingKillAmount); } if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag2 || flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { base.OnDeserialize(reader, initialState); if (initialState) { bodyIndex = (int)reader.ReadPackedUInt32(); killAmount = (int)reader.ReadPackedUInt32(); startingKillAmount = (int)reader.ReadPackedUInt32(); return; } int num = (int)reader.ReadPackedUInt32(); if ((num & 4) != 0) { bodyIndex = (int)reader.ReadPackedUInt32(); } if ((num & 8) != 0) { killAmount = (int)reader.ReadPackedUInt32(); } if ((num & 0x10) != 0) { startingKillAmount = (int)reader.ReadPackedUInt32(); } } } public class KillEnemiesObjective : QuestObjectiveBase { private KillEnemiesBehaviorBase _killEnemiesBehaviorBase; private int localKillAmount; private string name; public override string GenerateString() { if (!Object.op_Implicit((Object)(object)_killEnemiesBehaviorBase)) { _killEnemiesBehaviorBase = (KillEnemiesBehaviorBase)(object)((ObjectiveTracker)this).sourceDescriptor.source; questBehavior = _killEnemiesBehaviorBase; name = Language.GetString(BodyCatalog.GetBodyPrefab((BodyIndex)_killEnemiesBehaviorBase.bodyIndex).GetComponent().baseNameToken); } localKillAmount = _killEnemiesBehaviorBase.killAmount; string text = string.Format(QuestBase.instance.QuestDesc, _killEnemiesBehaviorBase.killAmount, name, (localKillAmount > 1) ? "s" : ""); if (!((Behaviour)_killEnemiesBehaviorBase).enabled) { ((ObjectiveTracker)this).retired = true; text = string.Format(QuestBase.instance.QuestDescRetired, _killEnemiesBehaviorBase.startingKillAmount, name, "s"); Object.Destroy((Object)(object)_killEnemiesBehaviorBase); } return GetPlayerName() + text; } public override bool IsDirty() { return true; } } public class NoDamage : QuestBase { public static ConfigEntry minTimer; public static ConfigEntry maxTimer; public static ConfigEntry ss1Behavior; public override string QuestName => "No Damage"; public override string QuestTitle => "the planet seeks entertainment .,,.."; public override string QuestDesc => "take no damage for {0} seconds,.,."; public override string QuestDescRetired => "took no damage for {0} seconds !!"; public override Sprite QuestIcon => questshrine.bundle.LoadAsset("nodamage"); public override bool useListeners => true; public override string[] Tags => new string[1] { "noStack" }; public override Type Behavior => typeof(NoDamageBehaviorBase); public override void CreateConfig(ConfigFile config) { minTimer = Utils.SliderConfig(ConfigHelper("min timer value", 15, "minimum timer value for damage not being taken .,,.")); maxTimer = Utils.SliderConfig(ConfigHelper("max timer value", 45, "max timer value for damage not being taken .,,.")); ss1Behavior = Utils.CheckboxConfig(ConfigHelper("starstorm 1 behavior", value: true, "should use starstorm 1 behavior (reset timer on hit),., disabling will cause the quest to fail upon taking damage with no reward,.,.")); } } public class NoDamageBehaviorBase : QuestBehaviorBase { [SyncVar] public float timer; [SyncVar] public float startingTime; public bool gaveReward; public override QuestBase QuestBase => QuestBase.instance; public override Type ObjectiveType => typeof(NoDamageObjective); public float Networktimer { get { return timer; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref timer, 4u); } } public float NetworkstartingTime { get { return startingTime; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref startingTime, 8u); } } public override void StartQuest() { if (!NetworkServer.active) { base.StartQuest(); return; } TakeDamageServer = (Action)Delegate.Combine(TakeDamageServer, new Action(OnTakeDamageServer)); NetworkstartingTime = Run.instance.runRNG.RangeFloat((float)NoDamage.minTimer.Value, (float)NoDamage.maxTimer.Value) - 0.75f; Networktimer = startingTime + 2f; base.NetworkQuestDescInternal = string.Format(QuestBase.instance.QuestDesc, startingTime.ToString("0")); base.StartQuest(); } public void FixedUpdate() { if (NetworkServer.active) { Networktimer = timer - Time.fixedDeltaTime; if ((double)timer < 0.5 && !gaveReward) { gaveReward = true; QuestBase.instance.GiveReward(base.body); base.CallRpcRetire(); } } } public void OnTakeDamageServer(DamageReport damageReport) { if (NoDamage.ss1Behavior.Value) { Networktimer = startingTime; } else { base.CallRpcRetire(); } } public override void OnDisable() { TakeDamageServer = (Action)Delegate.Remove(TakeDamageServer, new Action(OnTakeDamageServer)); base.OnDisable(); } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool flag = base.OnSerialize(writer, forceAll); if (forceAll) { writer.Write(timer); writer.Write(startingTime); return true; } bool flag2 = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & 4) != 0) { if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag2 = true; } writer.Write(timer); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8) != 0) { if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag2 = true; } writer.Write(startingTime); } if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag2 || flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { base.OnDeserialize(reader, initialState); if (initialState) { timer = reader.ReadSingle(); startingTime = reader.ReadSingle(); return; } int num = (int)reader.ReadPackedUInt32(); if ((num & 4) != 0) { timer = reader.ReadSingle(); } if ((num & 8) != 0) { startingTime = reader.ReadSingle(); } } } public class NoDamageObjective : QuestObjectiveBase { private NoDamageBehaviorBase noDamageQuest; public override string GenerateString() { if (!Object.op_Implicit((Object)(object)noDamageQuest)) { noDamageQuest = (NoDamageBehaviorBase)(object)((ObjectiveTracker)this).sourceDescriptor.source; questBehavior = noDamageQuest; } string text = string.Format(QuestBase.instance.QuestDesc, noDamageQuest.timer.ToString("0")); if (!((Behaviour)noDamageQuest).enabled) { ((ObjectiveTracker)this).retired = true; text = string.Format(QuestBase.instance.QuestDescRetired, noDamageQuest.startingTime.ToString("0")); Object.Destroy((Object)(object)noDamageQuest); } return GetPlayerName() + text; } public override bool IsDirty() { return true; } } public class Scrap : QuestBase { public string questDescSpecific = "scrap a {0},.,."; public static ConfigEntry specificItem; public override string QuestName => "Scrap Item"; public override string QuestTitle => "the planet hungers .,,.."; public override string QuestDesc => "scrap a {0} item,.,."; public override string QuestDescRetired => "scrapped a {0} item !!!"; public string questDescSpecificRetired => "scrapped a {0} !!!"; public override Sprite QuestIcon => questshrine.bundle.LoadAsset("scrapper"); public override string[] Tags => new string[1] { "requireScrapper" }; public override Type Behavior => typeof(ScrapItemBehaviorBase); public override void CreateConfig(ConfigFile config) { specificItem = config.Bind("Quest Shrine - " + QuestName, "Should the quest be a specific item to scrap .,.,", false, ""); Utils.CheckboxConfig(specificItem); } public override void Hooks() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ScrapperController.BeginScrapping_UniquePickup += new hook_BeginScrapping_UniquePickup(QuestScrapper); } private void QuestScrapper(orig_BeginScrapping_UniquePickup orig, ScrapperController self, UniquePickup pickuptotake) { //IL_0045: 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_0115: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Invalid comparison between I4 and Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b5: Invalid comparison between I4 and Unknown Interactor interactor = self.interactor; object obj; if (interactor == null) { obj = null; } else { CharacterBody component = ((Component)interactor).gameObject.GetComponent(); obj = ((component != null) ? component.master : null); } CharacterMaster interactorMaster = (CharacterMaster)obj; if (!Object.op_Implicit((Object)(object)interactorMaster) || !NetworkServer.active) { orig.Invoke(self, pickuptotake); return; } QuestBehaviorBase[] array = QuestBehaviorBase.activeQuests.Where((QuestBehaviorBase quest) => (Object)(object)quest.charMaster == (Object)(object)interactorMaster && quest is ScrapItemBehaviorBase).ToArray(); if (array.Length == 0) { orig.Invoke(self, pickuptotake); return; } QuestBehaviorBase[] array2 = array; for (int num = 0; num < array2.Length; num++) { ScrapItemBehaviorBase scrapItemBehaviorBase = (ScrapItemBehaviorBase)array2[num]; if (specificItem.Value && scrapItemBehaviorBase.targetItemIndex != -1) { if (scrapItemBehaviorBase.targetItemIndex != (int)PickupCatalog.GetPickupDef(pickuptotake.pickupIndex).itemIndex) { continue; } } else if (scrapItemBehaviorBase.targetTier != (int)PickupCatalog.GetPickupDef(pickuptotake.pickupIndex).itemTier) { continue; } GiveReward(scrapItemBehaviorBase.body); ((QuestBehaviorBase)scrapItemBehaviorBase).CallRpcRetire(); int maxItemsToScrapAtATime = self.maxItemsToScrapAtATime; self.maxItemsToScrapAtATime = 1; orig.Invoke(self, pickuptotake); self.maxItemsToScrapAtATime = maxItemsToScrapAtATime; return; } orig.Invoke(self, pickuptotake); } } public class ScrapItemBehaviorBase : QuestBehaviorBase { [SyncVar] public int targetTier; [SyncVar] public int targetItemIndex = -1; public override QuestBase QuestBase => QuestBase.instance; public override Type ObjectiveType => typeof(ScrapItemObjective); public int NetworktargetTier { get { return targetTier; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref targetTier, 4u); } } public int NetworktargetItemIndex { get { return targetItemIndex; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref targetItemIndex, 8u); } } public override void StartQuest() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected I4, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected I4, but got Unknown //IL_01a8: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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_01c8: Invalid comparison between Unknown and I4 //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected I4, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Invalid comparison between Unknown and I4 //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected I4, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { base.StartQuest(); return; } BasicPickupDropTable val = ScriptableObject.CreateInstance(); val.tier1Weight = 0f; val.tier2Weight = 0f; val.tier3Weight = 0f; ReadOnlySpan nonZeroIndicesSpan = ((ItemCollection)(ref base.body.inventory.effectiveItemStacks)).GetNonZeroIndicesSpan(); int i; for (i = 0; i < nonZeroIndicesSpan.Length; i++) { int num = (int)nonZeroIndicesSpan[i]; ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)num); ItemTier tier = ItemCatalog.GetItemDef((ItemIndex)num).tier; if (itemDef.canRemove && !itemDef.hidden && !itemDef.ContainsTag((ItemTag)10) && !itemDef.ContainsTag((ItemTag)13)) { switch ((int)tier) { case 0: val.tier1Weight = 0.8f; break; case 1: val.tier2Weight = 0.2f; break; case 2: val.tier3Weight = 0.01f; break; } } } Log.Debug($"weights {val.tier1Weight} {val.tier2Weight} {val.tier3Weight}"); if (val.tier1Weight == 0f && val.tier2Weight == 0f && val.tier3Weight == 0f) { NetworktargetTier = 0; } else { NetworktargetTier = (int)PickupCatalog.GetPickupDef(((PickupDropTable)val).GeneratePickup(Run.instance.runRNG).pickupIndex).itemTier; } if (Scrap.specificItem.Value) { WeightedSelection val2 = new WeightedSelection(8); bool flag = false; ReadOnlySpan nonZeroIndicesSpan2 = ((ItemCollection)(ref base.body.inventory.effectiveItemStacks)).GetNonZeroIndicesSpan(); int num2 = default(int); for (i = 0; i < nonZeroIndicesSpan2.Length; i++) { ItemIndex val3 = nonZeroIndicesSpan2[i]; ItemDef itemDef2 = ItemCatalog.GetItemDef(val3); ItemTier tier2 = ItemCatalog.GetItemDef(val3).tier; if (((int)tier2 == 0 || (int)tier2 == 1 || (int)tier2 == 2) && itemDef2.canRemove && !itemDef2.hidden && itemDef2.DoesNotContainTag((ItemTag)10) && itemDef2.DoesNotContainTag((ItemTag)13)) { switch ((int)tier2) { case 0: num2 = 80; break; case 1: num2 = 20; break; case 2: num2 = 1; break; default: global::.ThrowSwitchExpressionException(tier2); break; } int num3 = num2; val2.AddChoice(val3, (float)num3); flag = true; } } Log.Debug($"choice length {val2.choices.Length}"); if (flag) { NetworktargetItemIndex = (int)val2.Evaluate(Run.instance.treasureRng.nextNormalizedFloat); } } i = targetTier; string text = default(string); switch (i) { case 0: text = "Common"; break; case 1: text = "Uncommon"; break; case 2: text = "Legendary"; break; default: global::.ThrowSwitchExpressionException(i); break; } string arg = text; base.NetworkQuestDescInternal = string.Format(QuestBase.instance.QuestDesc, arg); if (Scrap.specificItem.Value && targetItemIndex != -1) { base.NetworkQuestDescInternal = string.Format(QuestBase.instance.questDescSpecific, Language.GetString(ItemCatalog.GetItemDef((ItemIndex)targetItemIndex).nameToken)); } base.StartQuest(); } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool flag = base.OnSerialize(writer, forceAll); if (forceAll) { writer.WritePackedUInt32((uint)targetTier); writer.WritePackedUInt32((uint)targetItemIndex); return true; } bool flag2 = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & 4) != 0) { if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag2 = true; } writer.WritePackedUInt32((uint)targetTier); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8) != 0) { if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag2 = true; } writer.WritePackedUInt32((uint)targetItemIndex); } if (!flag2) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag2 || flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { base.OnDeserialize(reader, initialState); if (initialState) { targetTier = (int)reader.ReadPackedUInt32(); targetItemIndex = (int)reader.ReadPackedUInt32(); return; } int num = (int)reader.ReadPackedUInt32(); if ((num & 4) != 0) { targetTier = (int)reader.ReadPackedUInt32(); } if ((num & 8) != 0) { targetItemIndex = (int)reader.ReadPackedUInt32(); } } } public class ScrapItemObjective : QuestObjectiveBase { private ScrapItemBehaviorBase scrapQuest; public override string GenerateString() { if (!Object.op_Implicit((Object)(object)scrapQuest)) { scrapQuest = (ScrapItemBehaviorBase)(object)((ObjectiveTracker)this).sourceDescriptor.source; questBehavior = scrapQuest; } int targetTier = scrapQuest.targetTier; string text = default(string); switch (targetTier) { case 0: text = "Common"; break; case 1: text = "Uncommon"; break; case 2: text = "Legendary"; break; default: global::.ThrowSwitchExpressionException(targetTier); break; } string arg = text; string text2 = string.Format(QuestBase.instance.QuestDesc, arg); if (Scrap.specificItem.Value && scrapQuest.targetItemIndex != -1) { text2 = string.Format(QuestBase.instance.questDescSpecific, Language.GetString(ItemCatalog.GetItemDef((ItemIndex)scrapQuest.targetItemIndex).nameToken)); } if (!((Behaviour)scrapQuest).enabled) { ((ObjectiveTracker)this).retired = true; text2 = string.Format(QuestBase.instance.QuestDescRetired, arg); if (Scrap.specificItem.Value && scrapQuest.targetItemIndex != -1) { text2 = string.Format(QuestBase.instance.questDescSpecificRetired, Language.GetString(ItemCatalog.GetItemDef((ItemIndex)scrapQuest.targetItemIndex).nameToken)); } Object.Destroy((Object)(object)scrapQuest); } return GetPlayerName() + text2; } public override bool IsDirty() { return true; } } } namespace questshrine.content.componentns { public class QuestShrineComponent : NetworkBehaviour { private static readonly GameObject shrineUseEffect = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/VFX/ShrineUseEffect.prefab").WaitForCompletion(); public PurchaseInteraction purchaseInteraction; public void Start() { if (NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance)) { purchaseInteraction.SetAvailable(true); } ((UnityEvent)(object)purchaseInteraction.onDetailedPurchaseServer).AddListener((UnityAction)OnPurchase); } [Server] public void OnPurchase(PayCostContext context, PayCostResults payCostResults) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_005d: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void questshrine.content.componentns.QuestShrineComponent::OnPurchase(RoR2.CostTypeDef/PayCostContext,RoR2.CostTypeDef/PayCostResults)' called on client"); return; } if (!NetworkServer.active) { Log.Warning("on purchase server called on client .,."); return; } EffectManager.SpawnEffect(shrineUseEffect, new EffectData { origin = ((Component)this).gameObject.transform.position, rotation = Quaternion.identity, scale = 3f, color = new Color32((byte)103, (byte)77, (byte)170, byte.MaxValue) }, true); purchaseInteraction.SetAvailable(false); ActivateQuest(context); } public void ActivateQuest(PayCostContext context) { WeightedSelection val = new WeightedSelection(8); QuestBase[] array = questshrine.instance.questObjectCatalog.Keys.ToArray(); foreach (QuestBase questBase in array) { float num = 10f; int num2 = QuestBehaviorBase.activeQuests.Count((QuestBehaviorBase quest) => quest.QuestBase == questBase && (Object)(object)quest.charMaster == (Object)(object)context.activatorMaster); Log.Debug(context.activatorMaster.GetBody().baseNameToken + " had " + num2 + " " + questBase.QuestName); for (int num3 = 0; num3 < num2; num3++) { num /= 2f; } if (questBase.Tags != null) { string[] tags = questBase.Tags; foreach (string text in tags) { if (!(text == "noStack")) { if (text == "requireScrapper" && !Object.op_Implicit((Object)(object)GameObject.Find("Scrapper(Clone)"))) { num = 0f; } } else if (num2 > 0) { num = 0f; } } } val.AddChoice(questBase, num); } QuestBase key = val.Evaluate(Run.instance.runRNG.nextNormalizedFloat); if (questshrine.instance.questObjectCatalog.TryGetValue(key, out var value)) { GameObject obj = Object.Instantiate(value); QuestBehaviorBase component = obj.GetComponent(); NetworkServer.Spawn(obj); component.NetworktargetMasterObject = ((Component)context.activatorMaster).gameObject; component.OnSyncTarget(((Component)context.activatorMaster).gameObject); } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } } } namespace questshrine.bases { public abstract class QuestBase : QuestBase where T : QuestBase { public static T instance { get; private set; } public QuestBase() { if (instance != null) { throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting QuestItemBase was instantiated twice"); } instance = this as T; } } public abstract class QuestBase { private static BasicPickupDropTable chest1DT = Addressables.LoadAssetAsync((object)RoR2_Base_Chest1.dtChest1_asset).WaitForCompletion(); public abstract string QuestName { get; } public abstract string QuestTitle { get; } public abstract string QuestDesc { get; } public virtual string QuestDescRetired => QuestDesc; public abstract Sprite QuestIcon { get; } public abstract Type Behavior { get; } public virtual bool useListeners { get; } public virtual string[] Tags { get; } public bool enabled => Utils.CheckboxConfig(((BaseUnityPlugin)questshrine.instance).Config.Bind("Quest Shrine - " + QuestName, "Enable " + QuestName, true, "")).Value; public virtual void Init(ConfigFile config) { if (enabled) { CreateConfig(config); Hooks(); } } public virtual void Hooks() { } public virtual void CreateConfig(ConfigFile config) { } public ConfigEntry ConfigHelper(string name, T value, string desc) { return ((BaseUnityPlugin)questshrine.instance).Config.Bind("Quest Shrine - " + QuestName, name, value, desc); } public virtual void GiveReward(CharacterBody body) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0064: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { PickupIndex pickupIndex = ((PickupDropTable)chest1DT).GeneratePickup(Run.instance.runRNG).pickupIndex; CreatePickupInfo val = default(CreatePickupInfo); ((CreatePickupInfo)(ref val)).pickup = new UniquePickup { pickupIndex = pickupIndex, decayValue = 0f }; PickupDropletController.CreatePickupDroplet(val, body.transform.position, Vector3.up * 20f); } } } public abstract class QuestBehaviorBase : NetworkBehaviour { public class QuestInterfaceListener : MonoBehaviour, IOnKilledOtherServerReceiver, IOnTakeDamageServerReceiver { public List questListeners = new List(); public void OnEnable() { ref IOnTakeDamageServerReceiver[] onTakeDamageReceivers = ref ((Component)this).gameObject.GetComponent().healthComponent.onTakeDamageReceivers; IOnTakeDamageServerReceiver val = (IOnTakeDamageServerReceiver)(object)this; ArrayUtils.ArrayAppend(ref onTakeDamageReceivers, ref val); } public void OnKilledOtherServer(DamageReport damageReport) { foreach (QuestBehaviorBase questListener in questListeners) { questListener?.KilledOtherServer?.Invoke(damageReport); } } public void OnTakeDamageServer(DamageReport damageReport) { foreach (QuestBehaviorBase questListener in questListeners) { questListener?.TakeDamageServer?.Invoke(damageReport); } } } public static List activeQuests; public static int notificationEnum; [SyncVar] public string QuestDescInternal; [SyncVar(hook = "OnSyncTarget")] public GameObject targetMasterObject; public CharacterMaster charMaster; public QuestInterfaceListener listener; private int startingStage; private bool ranStart; protected Action KilledOtherServer; protected Action TakeDamageServer; private NetworkInstanceId ___targetMasterObjectNetId; private static int kRpcRpcStartQuest; private static int kRpcRpcRetire; private NetworkInstanceId ___targetMasterObjectNetId; private static int kRpcRpcStartQuest; private static int kRpcRpcRetire; private NetworkInstanceId ___targetMasterObjectNetId; private static int kRpcRpcStartQuest; private static int kRpcRpcRetire; private NetworkInstanceId ___targetMasterObjectNetId; private static int kRpcRpcStartQuest; private static int kRpcRpcRetire; private NetworkInstanceId ___targetMasterObjectNetId; private static int kRpcRpcStartQuest; private static int kRpcRpcRetire; public abstract QuestBase QuestBase { get; } public abstract Type ObjectiveType { get; } public CharacterBody body { get { if (Object.op_Implicit((Object)(object)charMaster)) { return charMaster.GetBody(); } if (Object.op_Implicit((Object)(object)targetMasterObject)) { charMaster = targetMasterObject.GetComponent(); } CharacterMaster obj = charMaster; if (obj == null) { return null; } return obj.GetBody(); } } public string NetworkQuestDescInternal { get { return QuestDescInternal; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref QuestDescInternal, 1u); } } public GameObject NetworktargetMasterObject { get { return targetMasterObject; } [param: In] set { ref GameObject reference = ref targetMasterObject; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; OnSyncTarget(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref reference, 2u, ref this.___targetMasterObjectNetId); } } public string NetworkQuestDescInternal { get { return QuestDescInternal; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref QuestDescInternal, 1u); } } public GameObject NetworktargetMasterObject { get { return targetMasterObject; } [param: In] set { ref GameObject reference = ref targetMasterObject; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; OnSyncTarget(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref reference, 2u, ref this.___targetMasterObjectNetId); } } public string NetworkQuestDescInternal { get { return QuestDescInternal; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref QuestDescInternal, 1u); } } public GameObject NetworktargetMasterObject { get { return targetMasterObject; } [param: In] set { ref GameObject reference = ref targetMasterObject; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; OnSyncTarget(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref reference, 2u, ref this.___targetMasterObjectNetId); } } public string NetworkQuestDescInternal { get { return QuestDescInternal; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref QuestDescInternal, 1u); } } public GameObject NetworktargetMasterObject { get { return targetMasterObject; } [param: In] set { ref GameObject reference = ref targetMasterObject; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; OnSyncTarget(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref reference, 2u, ref this.___targetMasterObjectNetId); } } public string NetworkQuestDescInternal { get { return QuestDescInternal; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref QuestDescInternal, 1u); } } public GameObject NetworktargetMasterObject { get { return targetMasterObject; } [param: In] set { ref GameObject reference = ref targetMasterObject; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; OnSyncTarget(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVarGameObject(value, ref reference, 2u, ref ___targetMasterObjectNetId); } } public void OnSyncTarget(GameObject newTarget) { this.NetworktargetMasterObject = newTarget; charMaster = (Object.op_Implicit((Object)(object)newTarget) ? newTarget.gameObject.GetComponent() : null); Log.Debug($"syncing target {newTarget} {charMaster}"); if (!ranStart) { ranStart = true; StartQuest(); } } private void Awake() { activeQuests.Add(this); if (Object.op_Implicit((Object)(object)targetMasterObject)) { charMaster = targetMasterObject.GetComponent(); } startingStage = Run.instance.stageClearCount; } [ClientRpc] public void RpcStartQuest() { Log.Debug("rpc ran"); } public virtual void StartQuest() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00b8: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //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_00e0: 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_0100: Expected O, but got Unknown Log.Debug(charMaster.GetBody().baseNameToken + " starting quest"); Log.Debug(LocalUserManager.GetFirstLocalUser().cachedMaster.GetBody().baseNameToken + " local player"); ObjectivePanelController.collectObjectiveSources += OnCollectObjectiveSources; CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(charMaster); NotificationInfo val = new NotificationInfo((object)QuestBase, new TransformationInfo((TransformationType)notificationEnum, (object)null), new CustomOverrideInfo { titleText = QuestBase.QuestTitle, descriptionText = QuestDescInternal, iconColor = new Color(1f, 1f, 1f, 1f) }, false); if (Object.op_Implicit((Object)(object)notificationQueueForMaster)) { if (notificationQueueForMaster.notifications.Count != 0) { notificationQueueForMaster.notifications.Add(new TimedNotificationInfo { notification = val, startTime = Run.instance.fixedTime, duration = 3f }); } else { notificationQueueForMaster.PushNotification(val, 3f); } } charMaster.onBodyStart += AddListenersNewStageCheck; AddListenersNewStageCheck(body); } private void AddListenersNewStageCheck(CharacterBody body) { if (startingStage != Run.instance.stageClearCount) { Object.Destroy((Object)(object)this); } else if (QuestBase.useListeners) { if (((Component)body).gameObject.TryGetComponent(ref listener)) { listener.questListeners.Add(this); return; } listener = ((Component)body).gameObject.AddComponent(); listener.questListeners.Add(this); } } [ClientRpc] public void RpcRetire() { ((Behaviour)this).enabled = false; } public virtual void OnDisable() { ObjectivePanelController.collectObjectiveSources -= OnCollectObjectiveSources; if (QuestBase.useListeners) { listener.questListeners.Remove(this); if (listener.questListeners.Count == 0) { Object.Destroy((Object)(object)listener); } } charMaster.onBodyStart -= AddListenersNewStageCheck; activeQuests.Remove(this); } public virtual void OnCollectObjectiveSources(CharacterMaster master, List objectiveSourcesList) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0028: Unknown result type (might be due to invalid IL or missing references) ObjectiveSourceDescriptor item = new ObjectiveSourceDescriptor { master = master, objectiveType = ObjectiveType, source = (Object)(object)this }; objectiveSourcesList.Add(item); } static QuestBehaviorBase() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown activeQuests = new List(); notificationEnum = 1225; QuestBehaviorBase.kRpcRpcStartQuest = 1072638523; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcStartQuest, new CmdDelegate(InvokeRpcRpcStartQuest)); QuestBehaviorBase.kRpcRpcRetire = -1981223370; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcRetire, new CmdDelegate(InvokeRpcRpcRetire)); NetworkCRC.RegisterBehaviour("QuestBehaviorBase", 0); QuestBehaviorBase.kRpcRpcStartQuest = 1072638523; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcStartQuest, new CmdDelegate(QuestBehaviorBase.InvokeRpcRpcStartQuest)); QuestBehaviorBase.kRpcRpcRetire = -1981223370; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcRetire, new CmdDelegate(QuestBehaviorBase.InvokeRpcRpcRetire)); NetworkCRC.RegisterBehaviour("QuestBehaviorBase", 0); QuestBehaviorBase.kRpcRpcStartQuest = 1072638523; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcStartQuest, new CmdDelegate(QuestBehaviorBase.InvokeRpcRpcStartQuest)); QuestBehaviorBase.kRpcRpcRetire = -1981223370; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcRetire, new CmdDelegate(QuestBehaviorBase.InvokeRpcRpcRetire)); NetworkCRC.RegisterBehaviour("QuestBehaviorBase", 0); QuestBehaviorBase.kRpcRpcStartQuest = 1072638523; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcStartQuest, new CmdDelegate(QuestBehaviorBase.InvokeRpcRpcStartQuest)); QuestBehaviorBase.kRpcRpcRetire = -1981223370; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcRetire, new CmdDelegate(QuestBehaviorBase.InvokeRpcRpcRetire)); NetworkCRC.RegisterBehaviour("QuestBehaviorBase", 0); QuestBehaviorBase.kRpcRpcStartQuest = 1072638523; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcStartQuest, new CmdDelegate(QuestBehaviorBase.InvokeRpcRpcStartQuest)); QuestBehaviorBase.kRpcRpcRetire = -1981223370; NetworkBehaviour.RegisterRpcDelegate(typeof(QuestBehaviorBase), QuestBehaviorBase.kRpcRpcRetire, new CmdDelegate(QuestBehaviorBase.InvokeRpcRpcRetire)); NetworkCRC.RegisterBehaviour("QuestBehaviorBase", 0); } private void UNetVersion() { } protected static void InvokeRpcRpcStartQuest(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcStartQuest called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcStartQuest(); } } protected static void InvokeRpcRpcRetire(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcRetire called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcRetire(); } } public void CallRpcStartQuest() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcStartQuest called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)QuestBehaviorBase.kRpcRpcStartQuest); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcStartQuest"); } public void CallRpcRetire() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcRetire called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)QuestBehaviorBase.kRpcRpcRetire); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcRetire"); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(QuestDescInternal); writer.Write(targetMasterObject); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & 1) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(QuestDescInternal); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(targetMasterObject); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (initialState) { QuestDescInternal = reader.ReadString(); this.___targetMasterObjectNetId = reader.ReadNetworkId(); return; } int num = (int)reader.ReadPackedUInt32(); if ((num & 1) != 0) { QuestDescInternal = reader.ReadString(); } if ((num & 2) != 0) { OnSyncTarget(reader.ReadGameObject()); } } public override void PreStartClient() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkInstanceId)(ref this.___targetMasterObjectNetId)).IsEmpty()) { this.NetworktargetMasterObject = ClientScene.FindLocalObject(this.___targetMasterObjectNetId); } } protected static void InvokeRpcRpcStartQuest(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcStartQuest called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcStartQuest(); } } protected static void InvokeRpcRpcRetire(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcRetire called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcRetire(); } } public void CallRpcStartQuest() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcStartQuest called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)QuestBehaviorBase.kRpcRpcStartQuest); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcStartQuest"); } public void CallRpcRetire() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcRetire called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)QuestBehaviorBase.kRpcRpcRetire); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcRetire"); } protected static void InvokeRpcRpcStartQuest(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcStartQuest called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcStartQuest(); } } protected static void InvokeRpcRpcRetire(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcRetire called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcRetire(); } } public void CallRpcStartQuest() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcStartQuest called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)QuestBehaviorBase.kRpcRpcStartQuest); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcStartQuest"); } public void CallRpcRetire() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcRetire called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)QuestBehaviorBase.kRpcRpcRetire); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcRetire"); } protected static void InvokeRpcRpcStartQuest(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcStartQuest called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcStartQuest(); } } protected static void InvokeRpcRpcRetire(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcRetire called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcRetire(); } } public void CallRpcStartQuest() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcStartQuest called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)QuestBehaviorBase.kRpcRpcStartQuest); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcStartQuest"); } public void CallRpcRetire() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcRetire called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)QuestBehaviorBase.kRpcRpcRetire); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcRetire"); } protected static void InvokeRpcRpcStartQuest(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcStartQuest called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcStartQuest(); } } protected static void InvokeRpcRpcRetire(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcRetire called on server."); } else { ((QuestBehaviorBase)(object)obj).RpcRetire(); } } public void CallRpcStartQuest() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcStartQuest called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcStartQuest); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcStartQuest"); } public void CallRpcRetire() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcRetire called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcRetire); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcRetire"); } } public abstract class QuestObjectiveBase : ObjectiveTracker { public QuestBehaviorBase questBehavior; private string playerName; public string GetPlayerName() { if (playerName != null) { return playerName ?? ""; } QuestBehaviorBase questBehaviorBase = questBehavior; object obj; if (questBehaviorBase == null) { obj = null; } else { PlayerCharacterMasterController playerCharacterMasterController = questBehaviorBase.charMaster.playerCharacterMasterController; obj = ((playerCharacterMasterController != null) ? playerCharacterMasterController.GetDisplayName() : null); } playerName = (string)obj; if (LocalUserManager.GetFirstLocalUser().cachedMasterController.GetDisplayName() == playerName) { playerName = ""; } else { playerName = "(" + playerName + ") "; } return playerName ?? ""; } } }