forked from akanyan/mu3-mods
feat(UnlockGameEvents): mission event cycling
* Makes the game use the first available non-cleared mission. * Rather than the first available mission period. * No longer unlocks missions marked as expired by the server.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net35</TargetFramework>
|
||||
<Company>7EVENDAYS⇔HOLIDAYS</Company>
|
||||
<Version>3.2.0.0</Version>
|
||||
<Version>3.3.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Platforms>x64</Platforms>
|
||||
|
@ -19,6 +19,9 @@ class patch_PacketGetGameEvent: Packet {
|
||||
foreach(EventData eventData in SingletonStateMachine<DataManager, DataManager.EState>.instance.allEventData) {
|
||||
IdPeriod idPeriod = Enumerable.FirstOrDefault(_gameEvent.list, (IdPeriod e) => e.id == eventData.id);
|
||||
if(idPeriod != null) {
|
||||
if(eventData.itemType == DataStudio.EventType.MissionEvent) {
|
||||
continue;
|
||||
}
|
||||
if(idPeriod.period.endDate < CustomDateTime.Now) {
|
||||
idPeriod.period.endDate = endDate;
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
using MU3.Data;
|
||||
using MU3.User;
|
||||
using MU3.Util;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MU3.Operation;
|
||||
|
||||
class patch_OperationManager: OperationManager {
|
||||
private Dictionary<int, MissionEventData> _missionEventDataMap;
|
||||
|
||||
public extern MissionEventData orig_getTargetMissionFromChapterID(int chapterId);
|
||||
public new MissionEventData getTargetMissionFromChapterID(int chapterId) {
|
||||
return overrideMission(orig_getTargetMissionFromChapterID(chapterId));
|
||||
}
|
||||
|
||||
public extern MissionEventData orig_getTargetMissionFromStoryID(int storyId);
|
||||
public new MissionEventData getTargetMissionFromStoryID(int storyId) {
|
||||
return overrideMission(orig_getTargetMissionFromStoryID(storyId));
|
||||
}
|
||||
|
||||
private MissionEventData overrideMission(MissionEventData orig) {
|
||||
if(orig != null) {
|
||||
foreach(KeyValuePair<int, MissionEventData> item in _missionEventDataMap) {
|
||||
MissionEventData value = item.Value;
|
||||
if(!value.isMissionEventActive || value.eventData == null) {
|
||||
continue;
|
||||
}
|
||||
var userMissions = Singleton<UserManager>.instance.userMission;
|
||||
if(userMissions != null && userMissions.TryGetValue(value.missionEventId, out UserMission um)) {
|
||||
var rv = value.eventData.getNextEventPointBonus(out EventRewardInfo rewardInfo, um.Point);
|
||||
if(!rv || rewardInfo.bonus_.RewardNameAndCounts[0].isLoop) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return orig;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user