mu3-mods/UnlockMemoryChapters/MU3.Client/patch_PacketGetUserMemoryChapter.cs
akanyan cc7bc8613b feat: add the remaining things
* DisableMaintenance
* UnlockAllMusic
* UnlockGameEvents
* UnlockMemoryChapters
2024-07-08 02:10:46 +09:00

33 lines
1.5 KiB
C#

using MU3.Data;
using MU3.User;
using MU3.Util;
using System.Collections.Generic;
using System.Linq;
namespace MU3.Client;
class patch_PacketGetUserMemoryChapter: Packet {
private Dictionary<int, User.UserMemoryChapter> userMemoryChapter_;
public override State proc() {
switch(procImpl()) {
case State.Done: {
GetUserMemoryChapterResponse response_ = (query_ as GetUserMemoryChapter).response_;
foreach(MemoryChapterData memoryChapterData in SingletonStateMachine<DataManager, DataManager.EState>.instance.allMemoryChapterData) {
UserMemoryChapter userMemoryChapter = Enumerable.FirstOrDefault(response_.userMemoryChapterList, (UserMemoryChapter c) => c.chapterId == memoryChapterData.id);
if(userMemoryChapter != null) {
User.UserMemoryChapter userMemoryChapter2 = new User.UserMemoryChapter();
userMemoryChapter2.copyFrom(userMemoryChapter);
userMemoryChapter_[userMemoryChapter2.ChapterId] = userMemoryChapter2;
} else {
User.UserMemoryChapter userMemoryChapter3 = new User.UserMemoryChapter(memoryChapterData.id);
userMemoryChapter_[userMemoryChapter3.ChapterId] = userMemoryChapter3;
}
}
Singleton<UserManager>.instance.UserMemoryChapter = userMemoryChapter_;
break;
}
}
return state_;
}
}