Skip to content

Commit

Permalink
Merge pull request #2 from flameCmndr/master
Browse files Browse the repository at this point in the history
Fixes saving bugs and actually prevent store closing credit limitations
  • Loading branch information
avail authored Apr 2, 2020
2 parents af9f0e8 + 1ee263e commit bb99348
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 35 deletions.
19 changes: 0 additions & 19 deletions Components/BackupClosingTimePactches.cs

This file was deleted.

22 changes: 22 additions & 0 deletions Components/OperationManagerPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,30 @@ public class OperationManagerPatches
{
public static void Patch()
{
Harmony.PatchAllInType(typeof(OperationManagerPatches));
Harmony.MakeRET(typeof(OperationManager), "isAimeOffline");
Harmony.MakeRET(typeof(OperationManager), "isAimeLoginDisable");
Harmony.MakeRET(typeof(OperationManager), "isAutoRebootNeeded");
Harmony.MakeRET(typeof(OperationManager), "isClosed");
Harmony.MakeRET(typeof(OperationManager), "isCoinAcceptable", true);
Harmony.MakeRET(typeof(OperationManager), "isLoginDisable");
Harmony.MakeRET(typeof(OperationManager), "isRebootNeeded");
Harmony.MakeRET(typeof(OperationManager), "isShowClosingRemainingMinutes");
Harmony.MakeRET(typeof(OperationManager), "isUnderServerMaintenance");
}

[MethodPatch(PatchType.Prefix, typeof(OperationManager), "getCreditUseRestrictionByClose")]
static bool getCreditUseRestrictionByClose(ref ClosingManager.CreditUseRestriction __result)
{
__result = ClosingManager.CreditUseRestriction.None;
return false;
}

[MethodPatch(PatchType.Prefix, typeof(OperationManager), "getCreditUseRestrictionByMaintenance")]
static bool getCreditUseRestrictionByMaintenance(ref ClosingManager.CreditUseRestriction __result)
{
__result = ClosingManager.CreditUseRestriction.None;
return false;
}
}
}
20 changes: 5 additions & 15 deletions Components/SaveLoad/PacketPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,20 +525,9 @@ void UpdateForType(string fileName, List<MU3.User.UserActivity> array, UserActiv
void UpdateUserRecentRating(MU3.Client.UserRecentRating[] array)
{
string fileName = "UserRecentRating.json";
if (!FileSystem.Configuration.FileExists(fileName))
{
GetUserRecentRatingResponse recentRating = GetUserRecentRatingResponse.create();
FileSystem.Configuration.SaveJson(fileName, recentRating);
}

GetUserRecentRatingResponse temporary = FileSystem.Configuration.LoadJson<GetUserRecentRatingResponse>(fileName);
foreach (var item in array)
{
temporary.userRecentRatingList = new[] { item }
.Concat(temporary.userRecentRatingList)
.ToArray();
}
GetUserRecentRatingResponse temporary = new GetUserRecentRatingResponse();

temporary.userRecentRatingList = array;
temporary.userId = Singleton<UserManager>.instance.UserId;
temporary.length = temporary.userRecentRatingList.Length;
FileSystem.Configuration.SaveJson(fileName, temporary);
Expand Down Expand Up @@ -696,8 +685,9 @@ void UpdateUserChapter(MU3.Client.UserChapter[] array)
GetUserChapterResponse temporary = FileSystem.Configuration.LoadJson<GetUserChapterResponse>(fileName);
foreach (var item in array)
{
temporary.userChapterList = new[] { item }
.Concat(temporary.userChapterList)
temporary.userChapterList = temporary.userChapterList
.Where(a => a.chapterId != item.chapterId)
.Concat(new[] { item })
.ToArray();
}
temporary.length = temporary.userChapterList.Length;
Expand Down
1 change: 0 additions & 1 deletion Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ static void InitPatches()
Components.AMDaemonPatches.Patch();
Components.AMManagerPatches.Patch();
Components.BackupSettingPatches.Patch();
Components.BackupClosingTimePatches.Patch();
Components.BookkeepPatches.Patch();
Components.CreditPatches.Patch();
Components.JvsPatches.Patch();
Expand Down

0 comments on commit bb99348

Please sign in to comment.