From a4104a67e790974cd7bafd720094f8ffff3eee6b Mon Sep 17 00:00:00 2001 From: akanyan Date: Sun, 26 May 2024 08:15:13 +0900 Subject: [PATCH] feat: add infinite gp and skip premusic Also, run the autoformatter. Also, the skip is now cleaner. --- .gitignore | 3 +- BetterGiveUp/MU3.Game/patch_GameLED.cs | 6 +-- BetterGiveUp/MU3.Notes/patch_FieldObject.cs | 4 +- BetterGiveUp/MU3.Notes/patch_NotesManager.cs | 2 +- BetterGiveUp/MU3.Sequence/patch_PlayMusic.cs | 8 +-- ...patch_Scene_32_PrePlayMusic_MusicSelect.cs | 22 ++++++++ BetterGiveUp/MU3/patch_Scene_37_Result.cs | 46 ++++++++-------- BetterGiveUp/MU3/patch_Scene_38_End.cs | 53 +++++++++++-------- ExportChartData/MU3.Data/patch_DataManager.cs | 2 +- InfiniteGP/MU3.User/patch_UserManager.cs | 33 ++++++++++++ NaiveRating/MU3.User/patch_UserRating.cs | 12 ++--- SkipBullshit/MU3.Battle/patch_BattleCamera.cs | 8 +++ SkipBullshit/MU3.Battle/patch_BattleUI.cs | 22 ++++++++ SkipBullshit/MU3.Battle/patch_GameEngine.cs | 9 ++++ SkipBullshit/MU3.Sequence/patch_PlayMusic.cs | 19 +++++++ SkipNotice/MU3/patch_Scene_30_NoticeReward.cs | 40 +++++++------- 16 files changed, 205 insertions(+), 84 deletions(-) create mode 100644 BetterGiveUp/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs create mode 100644 InfiniteGP/MU3.User/patch_UserManager.cs create mode 100644 SkipBullshit/MU3.Battle/patch_BattleCamera.cs create mode 100644 SkipBullshit/MU3.Battle/patch_BattleUI.cs create mode 100644 SkipBullshit/MU3.Battle/patch_GameEngine.cs create mode 100644 SkipBullshit/MU3.Sequence/patch_PlayMusic.cs diff --git a/.gitignore b/.gitignore index 413ca7a..cdf3f4b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ *.csproj **/bin/* **/obj/* -*.dll \ No newline at end of file +*.dll +Common/ \ No newline at end of file diff --git a/BetterGiveUp/MU3.Game/patch_GameLED.cs b/BetterGiveUp/MU3.Game/patch_GameLED.cs index 36c8dbe..191030e 100644 --- a/BetterGiveUp/MU3.Game/patch_GameLED.cs +++ b/BetterGiveUp/MU3.Game/patch_GameLED.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; namespace MU3.Game; -public class patch_GameLED : GameLED { +public class patch_GameLED: GameLED { private patch_ButtonList _buttonList = new(); public extern void orig_initialize(); @@ -17,7 +17,7 @@ public class patch_GameLED : GameLED { orig_initialize(); } - private class patch_ButtonParam {} + private class patch_ButtonParam { } - private class patch_ButtonList : List {} + private class patch_ButtonList: List { } } \ No newline at end of file diff --git a/BetterGiveUp/MU3.Notes/patch_FieldObject.cs b/BetterGiveUp/MU3.Notes/patch_FieldObject.cs index 128446f..ad62644 100644 --- a/BetterGiveUp/MU3.Notes/patch_FieldObject.cs +++ b/BetterGiveUp/MU3.Notes/patch_FieldObject.cs @@ -6,9 +6,9 @@ using UnityEngine; namespace MU3.Notes; -public class patch_FieldObject : FieldObject { +public class patch_FieldObject: FieldObject { public class patch_BarNotes { - public class patch_Bar : BarNotes.Bar { + public class patch_Bar: BarNotes.Bar { public extern void orig_update(NotesManager mgr, float width = 1f); public new void update(NotesManager mgr, float width = 1f) { diff --git a/BetterGiveUp/MU3.Notes/patch_NotesManager.cs b/BetterGiveUp/MU3.Notes/patch_NotesManager.cs index ffbfe2a..234c4e4 100644 --- a/BetterGiveUp/MU3.Notes/patch_NotesManager.cs +++ b/BetterGiveUp/MU3.Notes/patch_NotesManager.cs @@ -7,7 +7,7 @@ using UnityEngine; namespace MU3.Notes; -public class patch_NotesManager : NotesManager { +public class patch_NotesManager: NotesManager { public extern void orig_reset(); public extern Vector3 orig_getEnemyPos(); diff --git a/BetterGiveUp/MU3.Sequence/patch_PlayMusic.cs b/BetterGiveUp/MU3.Sequence/patch_PlayMusic.cs index 5e2d091..0aabf03 100644 --- a/BetterGiveUp/MU3.Sequence/patch_PlayMusic.cs +++ b/BetterGiveUp/MU3.Sequence/patch_PlayMusic.cs @@ -12,7 +12,7 @@ using UnityEngine; namespace MU3.Sequence; -public class patch_PlayMusic : PlayMusic { +public class patch_PlayMusic: PlayMusic { private static readonly TimeSpan HOLD_DURATION = TimeSpan.FromSeconds(1.0f); private static readonly TimeSpan ROLL_DURATION = TimeSpan.FromSeconds(0.5f); public static bool QuickSkip = false; @@ -24,7 +24,7 @@ public class patch_PlayMusic : PlayMusic { private bool _isHoldingAck; private DateTime _holdingStartTime; private float enemyPosX; - private patch_NotesManager ntMgr => (patch_NotesManager) _gameEngine?.notesManager; + private patch_NotesManager ntMgr => (patch_NotesManager)_gameEngine?.notesManager; private extern void orig_Execute_Play(); public static double FadeOut(double progress, double min, double max) { @@ -66,12 +66,12 @@ public class patch_PlayMusic : PlayMusic { private void Execute_Play() { if(_isRolling) { TimeSpan timeSpan = CustomDateTime.Now - _rollingStartTime; - if (timeSpan <= ROLL_DURATION) { + if(timeSpan <= ROLL_DURATION) { double num1 = FadeOut(timeSpan.TotalMilliseconds / ROLL_DURATION.TotalMilliseconds, 0.0, 1.0); double num2 = FadeIn(timeSpan.TotalMilliseconds / ROLL_DURATION.TotalMilliseconds, 0.0, 1.0); ntMgr.setFrameForce(_totalRollingFrame * (float)(1.0 - num1)); ntMgr.enemyOffset = new Vector3( - ntMgr.enemyOffset.x + (enemyPosX - ntMgr.getEnemyPos().x), 20f * (float) num2, 0.0f + ntMgr.enemyOffset.x + (enemyPosX - ntMgr.getEnemyPos().x), 20f * (float)num2, 0.0f ); } else { EndRolling(); diff --git a/BetterGiveUp/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs b/BetterGiveUp/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs new file mode 100644 index 0000000..0d1ba1b --- /dev/null +++ b/BetterGiveUp/MU3/patch_Scene_32_PrePlayMusic_MusicSelect.cs @@ -0,0 +1,22 @@ +#pragma warning disable CS0626 +#pragma warning disable CS0649 +#pragma warning disable IDE0051 +#pragma warning disable IDE1006 +#pragma warning disable CS0108 +#pragma warning disable CS0414 + +using MU3.Sequence; + +namespace MU3; + +public class patch_Scene_32_PrePlayMusic_MusicSelect: Scene_32_PrePlayMusic_MusicSelect { + private bool _playVoice; + private extern void orig_Enter_Select(); + private void Enter_Select() { + if(patch_PlayMusic.QuickSkip) { + patch_PlayMusic.QuickSkip = false; + _playVoice = false; + } + orig_Enter_Select(); + } +} \ No newline at end of file diff --git a/BetterGiveUp/MU3/patch_Scene_37_Result.cs b/BetterGiveUp/MU3/patch_Scene_37_Result.cs index 3386a94..d79dd1a 100644 --- a/BetterGiveUp/MU3/patch_Scene_37_Result.cs +++ b/BetterGiveUp/MU3/patch_Scene_37_Result.cs @@ -8,28 +8,28 @@ using MU3.Util; namespace MU3; -public class patch_Scene_37_Result : Scene_37_Result { - private Mode mode_; - private extern void orig_Init_Init(); - private enum State { - Init, - Score, - Assignment, - ReleaseMaster, - GetMusic, - UnlockScenario, - Event, - MemoryChapterEvent, - CardCharaUp, - CardCharaWaitSkip, - CardCharaEnd, - End - } +public class patch_Scene_37_Result: Scene_37_Result { + private Mode mode_; + private extern void orig_Init_Init(); + private enum State { + Init, + Score, + Assignment, + ReleaseMaster, + GetMusic, + UnlockScenario, + Event, + MemoryChapterEvent, + CardCharaUp, + CardCharaWaitSkip, + CardCharaEnd, + End + } - private void Init_Init() { - orig_Init_Init(); - if(patch_PlayMusic.QuickSkip) { - mode_.set(State.End); - } - } + private void Init_Init() { + orig_Init_Init(); + if(patch_PlayMusic.QuickSkip) { + mode_.set(State.End); + } + } } \ No newline at end of file diff --git a/BetterGiveUp/MU3/patch_Scene_38_End.cs b/BetterGiveUp/MU3/patch_Scene_38_End.cs index a240137..c4cfe78 100644 --- a/BetterGiveUp/MU3/patch_Scene_38_End.cs +++ b/BetterGiveUp/MU3/patch_Scene_38_End.cs @@ -9,28 +9,37 @@ using MU3.Util; namespace MU3; -public class patch_Scene_38_End : Scene_38_End { - private Mode mode_; - private extern void orig_Init_Init(); - private int result_; - private enum State { - Init, - Continue, - SendResultContinue, - EndContinue, - ForceLogout, - ConsumeGP, - End, - WaitDestroy - } +public class patch_Scene_38_End: Scene_38_End { + private Mode mode_; + private extern void orig_Init_Init(); + private int result_; + private UICommonWindow commonWindow_; + private enum State { + Init, + Continue, + SendResultContinue, + EndContinue, + ForceLogout, + ConsumeGP, + End, + WaitDestroy + } - private void Init_Init() { - orig_Init_Init(); + private void Init_Init() { + orig_Init_Init(); - if(patch_PlayMusic.QuickSkip) { - result_ = 0; - mode_.set(State.End); - patch_PlayMusic.QuickSkip = false; - } - } + if(patch_PlayMusic.QuickSkip) { + result_ = 0; + mode_.set(State.End); + } + } + + private void End_Init() { + SystemUI instance = SingletonMonoBehaviour.instance; + instance.Panel.popState(); + if(!patch_PlayMusic.QuickSkip) { + instance.fadeOut(); + } + commonWindow_.end(); + } } \ No newline at end of file diff --git a/ExportChartData/MU3.Data/patch_DataManager.cs b/ExportChartData/MU3.Data/patch_DataManager.cs index fed6b6b..0d2df3a 100644 --- a/ExportChartData/MU3.Data/patch_DataManager.cs +++ b/ExportChartData/MU3.Data/patch_DataManager.cs @@ -7,7 +7,7 @@ using System.IO; namespace MU3.Data; -public class patch_DataManager : DataManager { +public class patch_DataManager: DataManager { private extern void orig_linkFumenAnalysisData(); private const string SEPARATOR = "$"; private string PrintHeader() { diff --git a/InfiniteGP/MU3.User/patch_UserManager.cs b/InfiniteGP/MU3.User/patch_UserManager.cs new file mode 100644 index 0000000..e0f42d9 --- /dev/null +++ b/InfiniteGP/MU3.User/patch_UserManager.cs @@ -0,0 +1,33 @@ +#pragma warning disable CS0626 +#pragma warning disable CS0649 +#pragma warning disable IDE0051 +#pragma warning disable IDE1006 +#pragma warning disable CS0108 + +namespace MU3.User; + +public class patch_UserManager: UserManager { + public const int DefaultGP = 666; + private int _gp; + private OnUpdate _onUpdateGP; + private OnReset _onResetGP; + + public void resetGP() { + _gp = 666; + if(_onResetGP != null) { + _onResetGP(_gp); + } + } + + public int GP { + get { + return _gp; + } + private set { + _gp = 666; + if(_onUpdateGP != null) { + _onUpdateGP(_gp); + } + } + } +} \ No newline at end of file diff --git a/NaiveRating/MU3.User/patch_UserRating.cs b/NaiveRating/MU3.User/patch_UserRating.cs index e5cdfe9..f5914b2 100644 --- a/NaiveRating/MU3.User/patch_UserRating.cs +++ b/NaiveRating/MU3.User/patch_UserRating.cs @@ -22,19 +22,19 @@ public class patch_UserRating: UserRating { var musicDict = usMgr.userMusic; - foreach (KeyValuePair item in musicDict) { + foreach(KeyValuePair item in musicDict) { MU3.Data.MusicData musicData = SingletonStateMachine.instance.getMusicData(item.Key); - if (musicData == null || item.Key == 1 || musicData.isBonusTrack) { + if(musicData == null || item.Key == 1 || musicData.isBonusTrack) { continue; } - for (int i = 0; i < 5; i++) { + for(int i = 0; i < 5; i++) { FumenDifficulty fumenDifficulty = (FumenDifficulty)i; UserFumen userFumen = usMgr.getUserFumen(item.Key, fumenDifficulty, create: false); - if (userFumen == null) { + if(userFumen == null) { continue; } Rating rating = new Rating(musicData.id, fumenDifficulty, userFumen.TechScoreMax); - if (rating.level100 == 0) { + if(rating.level100 == 0) { continue; } ratingList.Add(rating); @@ -48,7 +48,7 @@ public class patch_UserRating: UserRating { private void calcRate() { _rating100 = 0; - foreach (Rating best in calcSane().Take(45)) { + foreach(Rating best in calcSane().Take(45)) { _rating100 += best.rate100; } _rating100 /= 45; diff --git a/SkipBullshit/MU3.Battle/patch_BattleCamera.cs b/SkipBullshit/MU3.Battle/patch_BattleCamera.cs new file mode 100644 index 0000000..e190317 --- /dev/null +++ b/SkipBullshit/MU3.Battle/patch_BattleCamera.cs @@ -0,0 +1,8 @@ + +using MU3.Battle; + +public class patch_BattleCamera: BattleCamera { + private void Enter_StartCutscene() { + setNextState(EState.ToPlay); + } +} \ No newline at end of file diff --git a/SkipBullshit/MU3.Battle/patch_BattleUI.cs b/SkipBullshit/MU3.Battle/patch_BattleUI.cs new file mode 100644 index 0000000..4fbfa69 --- /dev/null +++ b/SkipBullshit/MU3.Battle/patch_BattleUI.cs @@ -0,0 +1,22 @@ +using MU3.Util; +using System; +using UnityEngine; + +namespace MU3; + +public class patch_BattleUI: BattleUI { + private System.Collections.IEnumerator playReadyProc(Action onFinish) { + if(!SystemUI.Exists) { + onFinish(); + yield break; + } + SystemUI systemUI = SingletonMonoBehaviour.instance; + float time = 1.5f; + while(0f < time) { + yield return null; + time -= Time.deltaTime; + } + onFinish(); + systemUI.removeCanvas(MU3.Graphics.Const.SortOrder.UI); + } +} \ No newline at end of file diff --git a/SkipBullshit/MU3.Battle/patch_GameEngine.cs b/SkipBullshit/MU3.Battle/patch_GameEngine.cs new file mode 100644 index 0000000..478ef5b --- /dev/null +++ b/SkipBullshit/MU3.Battle/patch_GameEngine.cs @@ -0,0 +1,9 @@ +#pragma warning disable CS0108 + +namespace MU3.Battle; + +public class patch_GameEngine: GameEngine { + public bool isStartCutsceneFinish() { + return true; + } +} \ No newline at end of file diff --git a/SkipBullshit/MU3.Sequence/patch_PlayMusic.cs b/SkipBullshit/MU3.Sequence/patch_PlayMusic.cs new file mode 100644 index 0000000..1c9a514 --- /dev/null +++ b/SkipBullshit/MU3.Sequence/patch_PlayMusic.cs @@ -0,0 +1,19 @@ +#pragma warning disable CS0626 +#pragma warning disable CS0649 +#pragma warning disable IDE0051 +#pragma warning disable IDE1006 + +using MU3.Battle; + +namespace MU3.Sequence; + +public class patch_PlayMusic: PlayMusic { + private GameEngine _gameEngine; + private extern void orig_Execute_StartCutscene(); + + private void Execute_StartCutscene() { + orig_Execute_StartCutscene(); + _gameEngine.skipStartCutscene(); + setNextState(EState.Countdown); + } +} \ No newline at end of file diff --git a/SkipNotice/MU3/patch_Scene_30_NoticeReward.cs b/SkipNotice/MU3/patch_Scene_30_NoticeReward.cs index ff9c440..3de21de 100644 --- a/SkipNotice/MU3/patch_Scene_30_NoticeReward.cs +++ b/SkipNotice/MU3/patch_Scene_30_NoticeReward.cs @@ -3,30 +3,28 @@ #pragma warning disable IDE0051 #pragma warning disable IDE1006 -using MU3.Sequence; using MU3.Util; namespace MU3; -public class patch_Scene_30_NoticeReward : Scene_30_NoticeReward { - private Mode _mode; - private enum State - { - Attention, - Notice, - RankingReward, - TechnicalChallengeReward, - DailyBonus, - AimeCollab, - Present, - TrainingRoom, - FadeOut, - End - } +public class patch_Scene_30_NoticeReward: Scene_30_NoticeReward { + private Mode _mode; + private enum State { + Attention, + Notice, + RankingReward, + TechnicalChallengeReward, + DailyBonus, + AimeCollab, + Present, + TrainingRoom, + FadeOut, + End + } - private void Start() { - _mode = new Mode(this); - _mode.set(State.FadeOut); - SingletonMonoBehaviour.instance.Panel.pushState(0, show: true); - } + private void Start() { + _mode = new Mode(this); + _mode.set(State.FadeOut); + SingletonMonoBehaviour.instance.Panel.pushState(0, show: true); + } } \ No newline at end of file