Esempio n. 1
0
 /// <summary>
 /// Sets <paramref name="flag"/>'s value to <paramref name="value"/>
 /// </summary>
 /// <param name="flag">The target flag</param>
 /// <param name="value">Value to set</param>
 public static void SetFlag(CustomDungeonFlags flag, bool value)
 {
     if (AdvancedGameStatsManager.HasInstance)
     {
         AdvancedGameStatsManager.Instance.SetFlag(flag, value);
     }
 }
Esempio n. 2
0
        public static void MetaSetupHook(Action <MetaShopController> orig, MetaShopController meta)
        {
            orig(meta);
            List <ShopItemController> shopItems = (List <ShopItemController>)ItemControllersInfo.GetValue(meta);

            if (shopItems != null)
            {
                foreach (ShopItemController shopItem in shopItems)
                {
                    if (shopItem != null && shopItem.item != null && shopItem.item.encounterTrackable != null && shopItem.item.encounterTrackable.journalData != null)
                    {
                        PickupObject po = GetBlueprintUnlockedItem(shopItem.item.encounterTrackable);
                        if (po != null && po.encounterTrackable != null && po.encounterTrackable.prerequisites != null)
                        {
                            CustomDungeonFlags saveFlagToSetOnAcquisition = GetCustomFlagFromTargetItem(po.PickupObjectId);
                            if (saveFlagToSetOnAcquisition != CustomDungeonFlags.NONE)
                            {
                                shopItem.item.gameObject.AddComponent <SpecialPickupObject>().CustomSaveFlagToSetOnAcquisition = saveFlagToSetOnAcquisition;
                                if (AdvancedGameStatsManager.Instance.GetFlag(saveFlagToSetOnAcquisition))
                                {
                                    shopItem.ForceOutOfStock();
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public static void BaseShopSetupHook(Action <BaseShopController> orig, BaseShopController self)
 {
     orig(self);
     if (self.baseShopType == BaseShopController.AdditionalShopType.FOYER_META && self.ExampleBlueprintPrefab != null)
     {
         List <ShopItemController> shopItems = (List <ShopItemController>)BaseItemControllersInfo.GetValue(self);
         if (shopItems != null)
         {
             foreach (ShopItemController shopItem in shopItems)
             {
                 if (shopItem != null && shopItem.item != null && shopItem.item.encounterTrackable != null && shopItem.item.encounterTrackable.journalData != null)
                 {
                     PickupObject po = GetBlueprintUnlockedItem(shopItem.item.encounterTrackable);
                     if (po != null && po.encounterTrackable != null && po.encounterTrackable.prerequisites != null)
                     {
                         CustomDungeonFlags saveFlagToSetOnAcquisition = CustomDungeonFlags.NONE;
                         for (int i = 0; i < po.encounterTrackable.prerequisites.Length; i++)
                         {
                             if (po.encounterTrackable.prerequisites[i] is CustomDungeonPrerequisite && (po.encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).advancedPrerequisiteType ==
                                 CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG)
                             {
                                 saveFlagToSetOnAcquisition = (po.encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).customFlagToCheck;
                             }
                         }
                         if (saveFlagToSetOnAcquisition != CustomDungeonFlags.NONE)
                         {
                             shopItem.item.gameObject.AddComponent <SpecialPickupObject>().CustomSaveFlagToSetOnAcquisition = saveFlagToSetOnAcquisition;
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Gets <paramref name="flag"/>'s value
 /// </summary>
 /// <param name="flag">The flag to check</param>
 /// <returns>The value of <paramref name="flag"/> or <see langword="false"/> if <see cref="AdvancedGameStatsManager"/> doesn't have an instance</returns>
 public static bool GetFlag(CustomDungeonFlags flag)
 {
     if (!AdvancedGameStatsManager.HasInstance)
     {
         return(false);
     }
     return(AdvancedGameStatsManager.Instance.GetFlag(flag));
 }
 public bool GetFlag(CustomDungeonFlags flag)
 {
     if (flag == CustomDungeonFlags.NONE)
     {
         Debug.LogError("Something is attempting to get a NONE save flag!");
         return(false);
     }
     return(this.m_flags.Contains(flag));
 }
Esempio n. 6
0
        /// <summary>
        /// Returns <see langword="true"/> if the item with id of <paramref name="pickupObjectId"/> doesn't have a prerequisite with the type <see cref="CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG"/> or the value of the prerequisite's flag is
        /// <see langword="true"/>
        /// </summary>
        /// <param name="pickupObjectId">Id of the item to check</param>
        /// <returns>
        /// <see langword="true"/> if the item with id of <paramref name="pickupObjectId"/> doesn't have a prerequisite with the type <see cref="CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG"/> or the value of the prerequisite's
        /// flag is <see langword="true"/>
        /// </returns>
        private static bool GetMetaItemUnlockedAdvanced(int pickupObjectId)
        {
            CustomDungeonFlags flag = GetCustomFlagFromTargetItem(pickupObjectId);

            if (flag == CustomDungeonFlags.NONE)
            {
                return(true);
            }
            return(AdvancedGameStatsManager.Instance.GetFlag(flag));
        }
Esempio n. 7
0
 public static void PrintUnlock(CustomDungeonFlags flag, string itemname, string unlockPrereqs)
 {
     if (SaveAPIManager.GetFlag(flag))
     {
         ETGModConsole.Log($"{itemname} <color=#04eb00>[Unlocked]</color>!");
     }
     else
     {
         ETGModConsole.Log($"{itemname}  <color=#ff0000ff>[Locked]</color> - {unlockPrereqs}");
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Gets the custom flag to check from the last <see cref="CustomDungeonPrerequisite"/> with the type <see cref="CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG"/> of item with <paramref name="shopItemId"/> id
        /// </summary>
        /// <param name="shopItemId">The item's id</param>
        /// <returns>The flag from the last <see cref="CustomDungeonPrerequisite"/> with the type <see cref="CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG"/> of the item or <see cref="CustomDungeonFlags.NONE"/> if it didn't find it</returns>
        public static CustomDungeonFlags GetCustomFlagFromTargetItem(int shopItemId)
        {
            CustomDungeonFlags result = CustomDungeonFlags.NONE;
            PickupObject       byId   = PickupObjectDatabase.GetById(shopItemId);

            for (int i = 0; i < byId.encounterTrackable.prerequisites.Length; i++)
            {
                if (byId.encounterTrackable.prerequisites[i] is CustomDungeonPrerequisite && (byId.encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).advancedPrerequisiteType ==
                    CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG)
                {
                    result = (byId.encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).customFlagToCheck;
                }
            }
            return(result);
        }
 public void SetFlag(CustomDungeonFlags flag, bool value)
 {
     if (flag == CustomDungeonFlags.NONE)
     {
         Debug.LogError("Something is attempting to set a NONE save flag!");
         return;
     }
     if (value)
     {
         this.m_flags.Add(flag);
     }
     else
     {
         this.m_flags.Remove(flag);
     }
 }
Esempio n. 10
0
        public static void BaseShopSetupHook(Action <BaseShopController> orig, BaseShopController self)
        {
            orig(self);
            if (self.baseShopType == BaseShopController.AdditionalShopType.FOYER_META && self.ExampleBlueprintPrefab != null)
            {
                List <ShopItemController> shopItems = (List <ShopItemController>)BaseItemControllersInfo.GetValue(self);
                if (shopItems != null)
                {
                    foreach (ShopItemController shopItem in shopItems)
                    {
                        if (shopItem != null && shopItem.item != null && shopItem.item.encounterTrackable != null && shopItem.item.encounterTrackable.journalData != null)
                        {
                            //ETGModConsole.Log("GETTING BLUEPRINT ITEM FOR: " + shopItem.item.name);
                            PickupObject po = GetBlueprintUnlockedItem(shopItem.item.encounterTrackable);
                            //ETGModConsole.Log("BLUEPRINT ISN'T NULL: " + (po != null) + ", ENCOUNTERTRACKABLE ISN'T NULL: " + (po.encounterTrackable != null) + ", PREREQUISITES ISN'T NULL: " + (po.encounterTrackable != null));
                            if (po != null && po.encounterTrackable != null && po.encounterTrackable.prerequisites != null)
                            {
                                //ETGModConsole.Log("GAMEOBJECT NAME: " + po.name);
                                //ETGModConsole.Log("DATABASE OBJECT NAME: " + ETGMod.Databases.Items[po.gameObject.name].gameObject.name);
                                // ETGModConsole.Log("DATABASE OBJECT UNLOCK COUNT: " + ETGMod.Databases.Items[po.gameObject.name].encounterTrackable.prerequisites.Length);

                                CustomDungeonFlags saveFlagToSetOnAcquisition = CustomDungeonFlags.NONE;
                                for (int i = 0; i < po.encounterTrackable.prerequisites.Length; i++)
                                {
                                    //ETGModConsole.Log("LOOKING AT PREREQUISITE #" + i + ": " + po.encounterTrackable.prerequisites[i].GetType());
                                    if (po.encounterTrackable.prerequisites[i] is CustomDungeonPrerequisite && (po.encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).advancedPrerequisiteType ==
                                        CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG)
                                    {
                                        saveFlagToSetOnAcquisition = (po.encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).customFlagToCheck;
                                        //ETGModConsole.Log("FOUND FLAG: " + saveFlagToSetOnAcquisition);
                                    }
                                }
                                //ETGModConsole.Log("FINAL VALUE FOR FLAG: " + saveFlagToSetOnAcquisition);
                                if (saveFlagToSetOnAcquisition != CustomDungeonFlags.NONE)
                                {
                                    shopItem.item.gameObject.AddComponent <SpecialPickupObject>().CustomSaveFlagToSetOnAcquisition = saveFlagToSetOnAcquisition;
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Builds a new <see cref="MonsterHuntQuest"/> and adds it to the quest list
        /// </summary>
        /// <param name="questFlag">The flag that will be used to check if the quest is complete and will be set to true when the quest is completed</param>
        /// <param name="questIntroConversation">The list of text Frifle will say when giving the player the quest</param>
        /// <param name="targetEnemyName">The name that will be used when Frifle or Grey Mauser say how much enemies are remaining</param>
        /// <param name="targetEnemies">List of enemies that can progress the quest</param>
        /// <param name="numberKillsRequired">Amount of kills that are required for the quest to be completed</param>
        /// <param name="rewardFlags">Flags that will be set when the player talks to Frifle or the Grey Mauser after completing the quest</param>
        /// <param name="customRewardFlags">Custom flags that will be set when the player talks to Frifle or the Grey Mauser after completing the quest</param>
        /// <param name="requiredState">Enemy state that will be required for the quest to count the kill</param>
        /// <param name="validTargetCheck">Custom check function that will be used to check if a kill is valid</param>
        /// <param name="index">Index to add the quest at</param>
        /// <returns>The built quest</returns>
        public static MonsterHuntQuest AddQuest(CustomDungeonFlags questFlag, List <string> questIntroConversation, string targetEnemyName, List <AIActor> targetEnemies, int numberKillsRequired, List <GungeonFlags> rewardFlags = null,
                                                List <CustomDungeonFlags> customRewardFlags = null, JammedEnemyState requiredState = JammedEnemyState.NoCheck, Func <AIActor, MonsterHuntProgress, bool> validTargetCheck = null, int?index = null)
        {
            string questStringPrefix      = "#CUSTOMQUEST_" + questFlag.ToString() + "_" + Guid.NewGuid().ToString().ToUpper();
            string questIntroString       = questStringPrefix + "_INTRO";
            string questTargetEnemyString = questStringPrefix + "_TARGET";

            ETGMod.Databases.Strings.Core.SetComplex(questIntroString, questIntroConversation.ToArray());
            ETGMod.Databases.Strings.Core.Set(questTargetEnemyString, targetEnemyName);
            return(AddQuest(new CustomHuntQuest()
            {
                QuestFlag = GungeonFlags.NONE,
                QuestIntroString = questIntroString,
                TargetStringKey = questTargetEnemyString,
                ValidTargetMonsterGuids = targetEnemies.Convert(delegate(AIActor enemy) { return enemy.EnemyGuid; }),
                FlagsToSetUponReward = rewardFlags != null ? SaveTools.CloneList(rewardFlags) : new List <GungeonFlags>(),
                CustomFlagsToSetUponReward = customRewardFlags != null ? SaveTools.CloneList(customRewardFlags) : new List <CustomDungeonFlags>(),
                NumberKillsRequired = numberKillsRequired,
                RequiredEnemyState = requiredState,
                ValidTargetCheck = validTargetCheck,
                CustomQuestFlag = questFlag
            }, index));
        }
Esempio n. 12
0
 // Token: 0x06000057 RID: 87 RVA: 0x00006B04 File Offset: 0x00004D04
 public static bool GetCustomDungeonFlag(CustomDungeonFlags flag)
 {
     return(GameStatsManager.Instance.GetFlag(CustomGungeonFlagsManager.GetGungeonFlagForCustomDungeonFlag(flag)));
 }
Esempio n. 13
0
        public static void AddFoyerObject(string character, GameObject obj, Vector2 offset, CustomDungeonFlags requiredFlag = CustomDungeonFlags.NONE)
        {
            character = character.ToLower();
            if (CharacterBuilder.storedCharacters.ContainsKey(character))
            {
                var cc = CharacterBuilder.storedCharacters[character].First;
                obj.layer = 22;
                var flagDisabler = obj.AddComponent <CustomSimpleFlagDisabler>();
                flagDisabler.FlagToCheckFor      = requiredFlag;
                flagDisabler.UseNumberOfAttempts = false;

                CharacterBuilder.storedCharacters[character].First.randomFoyerBullshitNNAskedFor.Add(new Tuple <GameObject, Vector3>(obj, offset));
            }
            else
            {
                Debug.LogError($"No character found under the name \"{character}\" or tk2dSpriteAnimator is null");
            }
        }
Esempio n. 14
0
 // Token: 0x06000187 RID: 391 RVA: 0x00014114 File Offset: 0x00012314
 public static bool GetFlag(this GameStatsManager manager, CustomDungeonFlags flag)
 {
     return(CustomGungeonFlagsManager.GetCustomDungeonFlag(flag));
 }
Esempio n. 15
0
 // Token: 0x06000189 RID: 393 RVA: 0x00014144 File Offset: 0x00012344
 public static void SetupUnlockOnFlag(this PickupObject self, CustomDungeonFlags flag, bool requiredFlagValue)
 {
     self.SetupUnlockOnFlag(CustomGungeonFlagsManager.GetGungeonFlagForCustomDungeonFlag(flag), requiredFlagValue);
 }
Esempio n. 16
0
 // Token: 0x06000058 RID: 88 RVA: 0x00006B28 File Offset: 0x00004D28
 public static GungeonFlags GetGungeonFlagForCustomDungeonFlag(CustomDungeonFlags flag)
 {
     return((GungeonFlags)flag);
 }
Esempio n. 17
0
 // Token: 0x06000056 RID: 86 RVA: 0x00006AEC File Offset: 0x00004CEC
 public static void SetCustomDungeonFlag(CustomDungeonFlags flag, bool value)
 {
     GameStatsManager.Instance.SetFlag(CustomGungeonFlagsManager.GetGungeonFlagForCustomDungeonFlag(flag), value);
 }
Esempio n. 18
0
 // Token: 0x06000184 RID: 388 RVA: 0x000140F0 File Offset: 0x000122F0
 public static void SetFlag(this GameStatsManager manager, CustomDungeonFlags flag, bool value)
 {
     CustomGungeonFlagsManager.SetCustomDungeonFlag(flag, value);
 }