Example #1
0
            private static bool Prefix(ref StorySystem __instance)
            {
                if (!settings.lockFastQiyuCompletion)
                {
                    return(true);
                }
                if (__instance.storySystemStoryId == 10002 || __instance.storySystemStoryId == 10003 || __instance.storySystemStoryId == 10004)
                {
                    return(true);
                }
                __instance.ClossToStoryMenu();
                int num = DateFile.instance.ParseInt(DateFile.instance.baseStoryDate[__instance.storySystemStoryId][302]);

                if (num != 0)
                {
                    DateFile.instance.SetEvent(new int[3]
                    {
                        0,
                        -1,
                        num
                    }, addToFirst: true);
                    logger.Log("MassageWindow.DoEvent called");
                    MassageWindow_DoEvent.Invoke(MassageWindow.instance, new object[1]
                    {
                        0
                    });
                }
                else
                {
                    DateFile.instance.SetStory(true, __instance.storySystemPartId, __instance.storySystemPlaceId, 0, 0);
                    __instance.StoryEnd();
                }
                return(false);
            }
Example #2
0
            private static bool Prefix(ref StorySystem __instance)
            {
                if (!enabled || !settings.basicUISettings[3])
                {
                    return(true);
                }
                else
                {
                    int storyId = __instance.storySystemStoryId;
#if DEBUG
                    logger.Log($"[TaiwuEditor]OpenStory: StoryId: {storyId}");
#endif
                    if (storyId > 0)
                    {
                        bool storyIdExist = false;
                        for (int i = 0; i < settings.includedStoryTyps.Length; i++)
                        {
                            if (settings.includedStoryTyps[i])
                            {
                                if (settings.GetStoryTyp(i).IsContainStoryId(storyId))
                                {
                                    storyIdExist = true;
                                    break;
                                }
                            }
                        }
                        if (!storyIdExist)
                        {
                            return(true);
                        }
                        // 关闭奇遇窗口
                        __instance.ClossToStoryMenu();
                        // 终点的事件ID
                        int storyEndEventId = int.Parse(DateFile.instance.baseStoryDate[storyId][302]);
#if DEBUG
                        logger.Log($"[TaiwuEditor]OpenStory: storyEndEventId: {storyEndEventId}");
#endif
                        if (Helper.EventSetup(storyEndEventId, __instance.storySystemPartId, __instance.storySystemPlaceId, __instance.storySystemStoryId))
                        {
                            logger.Log("MassageWindow.DoEvent called");
                            try
                            {
                                // 调用MessageWindow.DoEvent(0)执行终点Event
                                MassageWindow.instance.Invoke("DoEvent", new object[] { 0 });
                            }
                            catch (Exception e)
                            {
                                logger.Log($"[TaiwuEditor]奇遇直达终点失效 storyEndEventId: {storyEndEventId}");
                                logger.Log(e.Message);
                                logger.Log(e.StackTrace);
                                // 如果出现问题则return true调用游戏本来的奇遇处理方法
                                return(true);
                            }
                        }
                        else
                        {
                            logger.Log($"[TaiwuEditor]OpenStory has been removed due to storyEndEventId is 0");
                            __instance.StoryEnd();
                        }
                        return(false);
                    }
                    return(true);
                }
            }
Example #3
0
        /// <summary>
        /// 奇遇直接到终点
        /// </summary>
        private static bool StorySystem_OpenStory_Prefix(ref StorySystem __instance, ref bool ___keepHiding)
        {
            if (RuntimeConfig.DebugMode)
            {
                TaiwuEditor.Logger.LogInfo($"OpenStory: StoryId: {__instance.storySystemStoryId}");
            }

            if (!TaiwuEditor.enabled || !TaiwuEditor.settings.StoryCheat.Value)
            {
                return(true);
            }

            /// 借鉴<see cref="StorySystem.StorySystemOpend"/>。<see cref="StorySystem.StoryToBattle"/>会将此值设为true
            /// 用这个值判断是否本次调用<see cref="StorySystem.OpenStory"/>是否由<see cref="StorySystem.StoryToBattle"/>
            /// 返回的,防止奇遇终点是战斗时,无限进入战斗。
            if (___keepHiding)
            {
                return(true);
            }

            int storyId = __instance.storySystemStoryId;

            if (storyId > 0)
            {
                bool storyIdExist = false;
                for (int i = 0; i < TaiwuEditor.settings.includedStoryTyps.Value.Length; i++)
                {
                    if (TaiwuEditor.settings.includedStoryTyps.Value[i])
                    {
                        if (TaiwuEditor.settings.GetStoryTyp(i).IsContainStoryId(storyId))
                        {
                            storyIdExist = true;
                            break;
                        }
                    }
                }
                if (!storyIdExist)
                {
                    return(true);
                }
                // 关闭奇遇窗口
                ToStoryMenu.Instance.CloseToStoryMenu();
                // 终点的事件ID
                int storyEndEventId = int.Parse(DateFile.instance.baseStoryDate[storyId][302]);
                if (RuntimeConfig.DebugMode)
                {
                    TaiwuEditor.Logger.LogInfo($"OpenStory: storyEndEventId: {storyEndEventId}");
                    TaiwuEditor.Logger.LogInfo($"OpenStory: StoryPlayer: {StorySystem.instance.storyPlayer.name}");
                    TaiwuEditor.Logger.LogInfo($"OpenStory: StoryPlayer_placeid: {StorySystem.instance.storyPlayer.parent.parent.parent.name}");
                }

                if (!Helper.EventSetup(StorySystem.StoryBaseManager, storyEndEventId,
                                       __instance.storySystemPartId, __instance.storySystemPlaceId,
                                       __instance.storySystemStoryId))
                {
                    TaiwuEditor.Logger.LogInfo($"OpenStory has been removed due to storyEndEventId is 0");
                    __instance.StoryEnd();
                }
                return(false);
            }
            return(true);
        }
Example #4
0
            private static bool Prefix(ref StorySystem __instance, ref bool ___keepHiding)
            {
                if (!Main.enabled || !Main.settings.basicUISettings[3])
                {
                    return(true);
                }

                /// 借鉴<see cref="StorySystem.StorySystemOpend"/>。<see cref="StorySystem.StoryToBattle"/>会将此值设为true
                /// 用这个值判断是否本次调用<see cref="StorySystem.OpenStory"/>是否由<see cref="StorySystem.StoryToBattle"/>
                /// 返回的,防止奇遇终点是战斗时,无限进入战斗。
                if (___keepHiding)
                {
                    return(true);
                }

                int storyId = __instance.storySystemStoryId;

#if DEBUG
                Main.logger.Log($"[TaiwuEditor]OpenStory: StoryId: {storyId}");
#endif
                if (storyId > 0)
                {
                    bool storyIdExist = false;
                    for (int i = 0; i < Main.settings.includedStoryTyps.Length; i++)
                    {
                        if (Main.settings.includedStoryTyps[i])
                        {
                            if (Main.settings.GetStoryTyp(i).IsContainStoryId(storyId))
                            {
                                storyIdExist = true;
                                break;
                            }
                        }
                    }
                    if (!storyIdExist)
                    {
                        return(true);
                    }
                    // 关闭奇遇窗口
                    ToStoryMenu.Instance.CloseToStoryMenu();
                    // 终点的事件ID
                    int storyEndEventId = int.Parse(DateFile.instance.baseStoryDate[storyId][302]);
#if DEBUG
                    Main.logger.Log($"[TaiwuEditor]OpenStory: storyEndEventId: {storyEndEventId}");
                    Main.logger.Log($"[TaiwuEditor]OpenStory: StoryPlayer: {StorySystem.instance.storyPlayer.name}");
                    Main.logger.Log($"[TaiwuEditor]OpenStory: StoryPlayer_placeid: {StorySystem.instance.storyPlayer.parent.parent.parent.name}");
#endif
                    if (HelperBase.EventSetup(StorySystem.StoryBaseManager, storyEndEventId,
                                              __instance.storySystemPartId, __instance.storySystemPlaceId,
                                              __instance.storySystemStoryId))
                    {
#if DEBUG
                        Main.logger.Log("EventSetup successful");
#endif
                    }
                    else
                    {
                        Main.logger.Log($"[TaiwuEditor]OpenStory has been removed due to storyEndEventId is 0");
                        __instance.StoryEnd();
                    }
                    return(false);
                }
                return(true);
            }