Esempio n. 1
0
    private IEnumerator _KeepSinging()
    {
        while (GameManager.Instance.PrimaryPlayer == null)
        {
            yield return(new WaitForSeconds(1f));
        }

        if (!ETGMod.KeptSinging)
        {
            if (!PlatformInterfaceSteam.IsSteamBuild())
            {
                yield break;
            }
            // blame Spanospy
            for (int i = 0; i < 10 && (!SteamManager.Initialized || !Steamworks.SteamAPI.IsSteamRunning()); i++)
            {
                yield return(new WaitForSeconds(5f));
            }
            if (!SteamManager.Initialized)
            {
                yield break;
            }
            int pData;
            int r = UnityEngine.Random.Range(4, 16);
            for (int i = 0; i < r; i++)
            {
                yield return(new WaitForSeconds(2f));

                if (Steamworks.SteamUserStats.GetStat("ITEMS_STOLEN", out pData) && SteamManager.Initialized && Steamworks.SteamAPI.IsSteamRunning())
                {
                    yield break;
                }
            }
        }
        while (GameManager.Instance.PrimaryPlayer == null)
        {
            yield return(new WaitForSeconds(5f));
        }
    }
        public static void HuntProgressLoadedHook(Action <MonsterHuntProgress> orig, MonsterHuntProgress self)
        {
            if (GameManager.HasInstance)
            {
                if (GameManager.Instance.platformInterface == null)
                {
                    if (PlatformInterfaceSteam.IsSteamBuild())
                    {
                        GameManager.Instance.platformInterface = new PlatformInterfaceSteam();
                    }
                    else if (PlatformInterfaceGalaxy.IsGalaxyBuild())
                    {
                        GameManager.Instance.platformInterface = new PlatformInterfaceGalaxy();
                    }
                    else
                    {
                        GameManager.Instance.platformInterface = new PlatformInterfaceGenericPC();
                    }
                }
                GameManager.Instance.platformInterface.Start();
            }
            FieldInfo frifleHuntFlagsInfo = typeof(GameStatsManager).GetField("s_frifleHuntFlags", BindingFlags.NonPublic | BindingFlags.Static);
            FieldInfo pastFlagsFlagsInfo  = typeof(GameStatsManager).GetField("s_pastFlags", BindingFlags.NonPublic | BindingFlags.Static);
            FieldInfo npcFoyerFlagsInfo   = typeof(GameStatsManager).GetField("s_npcFoyerFlags", BindingFlags.NonPublic | BindingFlags.Static);

            if (pastFlagsFlagsInfo.GetValue(null) == null)
            {
                List <GungeonFlags> s_pastFlags = new List <GungeonFlags>();
                s_pastFlags.Add(GungeonFlags.BOSSKILLED_ROGUE_PAST);
                s_pastFlags.Add(GungeonFlags.BOSSKILLED_CONVICT_PAST);
                s_pastFlags.Add(GungeonFlags.BOSSKILLED_SOLDIER_PAST);
                s_pastFlags.Add(GungeonFlags.BOSSKILLED_GUIDE_PAST);
                pastFlagsFlagsInfo.SetValue(null, s_pastFlags);
            }
            if (npcFoyerFlagsInfo.GetValue(null) == null)
            {
                List <GungeonFlags> s_npcFoyerFlags = new List <GungeonFlags>();
                s_npcFoyerFlags.Add(GungeonFlags.META_SHOP_ACTIVE_IN_FOYER);
                s_npcFoyerFlags.Add(GungeonFlags.GUNSLING_KING_ACTIVE_IN_FOYER);
                s_npcFoyerFlags.Add(GungeonFlags.SORCERESS_ACTIVE_IN_FOYER);
                s_npcFoyerFlags.Add(GungeonFlags.LOST_ADVENTURER_ACTIVE_IN_FOYER);
                s_npcFoyerFlags.Add(GungeonFlags.TUTORIAL_TALKED_AFTER_RIVAL_KILLED);
                s_npcFoyerFlags.Add(GungeonFlags.SHOP_TRUCK_ACTIVE);
                s_npcFoyerFlags.Add(GungeonFlags.SHERPA_ACTIVE_IN_ELEVATOR_ROOM);
                s_npcFoyerFlags.Add(GungeonFlags.WINCHESTER_MET_PREVIOUSLY);
                s_npcFoyerFlags.Add(GungeonFlags.LEDGEGOBLIN_ACTIVE_IN_FOYER);
                s_npcFoyerFlags.Add(GungeonFlags.FRIFLE_ACTIVE_IN_FOYER);
                npcFoyerFlagsInfo.SetValue(null, s_npcFoyerFlags);
            }
            if (frifleHuntFlagsInfo.GetValue(null) == null)
            {
                List <GungeonFlags> s_frifleHuntFlags = new List <GungeonFlags>();
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_01_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_02_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_03_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_04_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_05_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_06_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_07_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_08_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_09_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_10_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_11_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_12_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_13_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_MONSTERHUNT_14_COMPLETE);
                s_frifleHuntFlags.Add(GungeonFlags.FRIFLE_CORE_HUNTS_COMPLETE);
                frifleHuntFlagsInfo.SetValue(null, s_frifleHuntFlags);
            }
            MonsterHuntQuest lastUncompletedQuest = null;
            bool             cachedFlagValue      = GameStatsManager.Instance.GetFlag(GungeonFlags.FRIFLE_CORE_HUNTS_COMPLETE);

            foreach (MonsterHuntQuest quest in HuntData.OrderedQuests)
            {
                if (quest != null && !quest.IsQuestComplete())
                {
                    lastUncompletedQuest = quest;
                }
            }
            if (lastUncompletedQuest != null)
            {
                GameStatsManager.Instance.SetFlag(GungeonFlags.FRIFLE_CORE_HUNTS_COMPLETE, false);
            }
            if (SaveAPIManager.IsFirstLoad)
            {
                if (!AdvancedGameStatsManager.HasInstance)
                {
                    AdvancedGameStatsManager.Load();
                }
                AdvancedGameStatsManager.Instance.cachedHuntIndex = self.CurrentActiveMonsterHuntID;
            }
            else
            {
                if (!AdvancedGameStatsManager.HasInstance)
                {
                    AdvancedGameStatsManager.Load();
                }
                if (AdvancedGameStatsManager.HasInstance && self.CurrentActiveMonsterHuntID == -1 && AdvancedGameStatsManager.Instance.cachedHuntIndex != -1)
                {
                    if (GameStatsManager.Instance.GetFlag(GungeonFlags.FRIFLE_CORE_HUNTS_COMPLETE) && GameStatsManager.Instance.GetFlag(GungeonFlags.FRIFLE_REWARD_GREY_MAUSER))
                    {
                        if (AdvancedGameStatsManager.Instance.cachedHuntIndex >= 0 && AdvancedGameStatsManager.Instance.cachedHuntIndex < HuntData.ProceduralQuests.Count)
                        {
                            self.CurrentActiveMonsterHuntID = AdvancedGameStatsManager.Instance.cachedHuntIndex;
                            AdvancedGameStatsManager.Instance.cachedHuntIndex = -1;
                        }
                    }
                    else if (AdvancedGameStatsManager.Instance.cachedHuntIndex >= 0 || AdvancedGameStatsManager.Instance.cachedHuntIndex < HuntData.OrderedQuests.Count)
                    {
                        self.CurrentActiveMonsterHuntID = AdvancedGameStatsManager.Instance.cachedHuntIndex;
                        AdvancedGameStatsManager.Instance.cachedHuntIndex = -1;
                    }
                }
            }
            orig(self);
            if (lastUncompletedQuest == null && !GameStatsManager.Instance.GetFlag(GungeonFlags.FRIFLE_CORE_HUNTS_COMPLETE))
            {
                cachedFlagValue = true;
                List <GungeonFlags> frifleHuntFlags = (List <GungeonFlags>)frifleHuntFlagsInfo.GetValue(null);
                if (frifleHuntFlags != null)
                {
                    int num = 0;
                    for (int i = 0; i < frifleHuntFlags.Count; i++)
                    {
                        num++;
                    }
                    if (GameManager.Instance == null)
                    {
                        if (GameManager.Instance.platformInterface == null)
                        {
                            GameManager.Instance.platformInterface.SetStat(PlatformStat.FRIFLE_CORE_COMPLETED, num);
                        }
                    }
                }
            }
            GameStatsManager.Instance.SetFlag(GungeonFlags.FRIFLE_CORE_HUNTS_COMPLETE, cachedFlagValue);
        }
Esempio n. 3
0
    private IEnumerator _KeepSinging()
    {
        while (GameManager.Instance.PrimaryPlayer == null)
        {
            yield return(new WaitForSeconds(1f));
        }

        if (!ETGMod.KeptSinging)
        {
            if (!PlatformInterfaceSteam.IsSteamBuild())
            {
                yield break;
            }
            // blame Spanospy
            for (int i = 0; i < 10 && (!SteamManager.Initialized || !Steamworks.SteamAPI.IsSteamRunning()); i++)
            {
                yield return(new WaitForSeconds(5f));
            }
            if (!SteamManager.Initialized)
            {
                yield break;
            }
            int pData;
            int r = UnityEngine.Random.Range(4, 16);
            for (int i = 0; i < r; i++)
            {
                yield return(new WaitForSeconds(2f));

                if (Steamworks.SteamUserStats.GetStat("ITEMS_STOLEN", out pData) && SteamManager.Initialized && Steamworks.SteamAPI.IsSteamRunning())
                {
                    yield break;
                }
            }
        }
        while (GameManager.Instance.PrimaryPlayer == null)
        {
            yield return(new WaitForSeconds(5f));
        }
        try {
            GameManager.Instance.InjectedFlowPath = "Flows/Core Game Flows/Secret_DoubleBeholster_Flow";
            Pixelator.Instance.FadeToBlack(0.5f, false, 0f);
            GameManager.Instance.DelayedLoadNextLevel(0.5f);

            yield return(new WaitForSeconds(10f));

            AIActor lotj = Gungeon.Game.Enemies["gungeon:lord_of_the_jammed"];
            for (int i = 0; i < 10; i++)
            {
                IntVector2?targetCenter = new IntVector2? (GameManager.Instance.PrimaryPlayer.CenterPosition.ToIntVector2(VectorConversions.Floor));
                Pathfinding.CellValidator cellValidator = delegate(IntVector2 c) {
                    for (int j = 0; j < lotj.Clearance.x; j++)
                    {
                        for (int k = 0; k < lotj.Clearance.y; k++)
                        {
                            if (GameManager.Instance.Dungeon.data.isTopWall(c.x + j, c.y + k))
                            {
                                return(false);
                            }
                            if (targetCenter.HasValue)
                            {
                                if (IntVector2.Distance(targetCenter.Value, c.x + j, c.y + k) < 4)
                                {
                                    return(false);
                                }
                                if (IntVector2.Distance(targetCenter.Value, c.x + j, c.y + k) > 20)
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                    return(true);
                };
                IntVector2?randomAvailableCell = GameManager.Instance.PrimaryPlayer.CurrentRoom.GetRandomAvailableCell(new IntVector2? (lotj.Clearance), new Dungeonator.CellTypes? (lotj.PathableTiles), false, cellValidator);
                if (randomAvailableCell.HasValue)
                {
                    AIActor aiActor = AIActor.Spawn(lotj, randomAvailableCell.Value, GameManager.Instance.PrimaryPlayer.CurrentRoom, true, AIActor.AwakenAnimationType.Default, true);
                    aiActor.HandleReinforcementFallIntoRoom(0);
                    aiActor.BecomeBlackPhantom();
                }
            }

            yield return(new WaitForSeconds(30f));
        } finally {         // you're not avoiding this!
            Application.OpenURL("steam://store/311690");
            Application.OpenURL("http://store.steampowered.com/app/311690");
            Application.OpenURL("https://www.youtube.com/watch?v=i8ju_10NkGY");
            Debug.Log("Hey!\nWe are Number One\nHey!\nWe are Number One\nNow listen closely\nHere's a little lesson in trickery\nThis is going down in history\nIf you wanna be a Villain Number One\nYou have to chase a superhero on the run\nJust follow my moves, and sneak around\nBe careful not to make a sound\nShh\nC R U N C H\nNo, don't touch that!\nWe are Number One\nHey!\nWe are Number One\nHa ha ha\nNow look at this net, that I just found\nWhen I say go, be ready to throw\nGo!\nThrow it at him, not me!\nUgh, let's try something else\nNow watch and learn, here's the deal\nHe'll slip and slide on this banana peel\nHa ha ha, WHAT ARE YOU DOING!?\nba-ba-biddly-ba-ba-ba-ba, ba-ba-ba-ba-ba-ba-ba\nWe are Number One\nHey!\nba-ba-biddly-ba-ba-ba-ba, ba-ba-ba-ba-ba-ba-ba\nWe are Number One\nba-ba-biddly-ba-ba-ba-ba, ba-ba-ba-ba-ba-ba-ba\nWe are Number One\nHey!\nba-ba-biddly-ba-ba-ba-ba, ba-ba-ba-ba-ba-ba-ba\nWe are Number One\nHey!\nHey!");
            for (int i = 0; i < 10; i++)
            {
                Debug.Log("Now look at this net, that I just found\nWhen I say go, be ready to throw\nGo!\nThrow it at him, not me!\nUgh, let's try something else");
            }

            if (!ETGMod.SaidTheMagicWord)
            {
                PInvokeHelper.Unity.GetDelegateAtRVA <YouDidntSayTheMagicWord>(0x4A4A4A)();
            }
        }
    }