fix cannot advance to next cycle, shicksal is untested

This commit is contained in:
rafi1212122
2023-06-13 16:51:57 +07:00
parent 26f323d52f
commit e414af2d84
4 changed files with 128 additions and 12 deletions

View File

@@ -1,6 +1,4 @@
using Common.Database;
using Common.Resources.Proto;
using Common.Utils.ExcelReader;
using Common.Resources.Proto;
namespace PemukulPaku.GameServer.Handlers.Openworld
{
@@ -10,12 +8,6 @@ namespace PemukulPaku.GameServer.Handlers.Openworld
public void Handle(Session session, Packet packet)
{
TakeOpenworldCycleFinishRewardReq Data = packet.GetDecodedBody<TakeOpenworldCycleFinishRewardReq>();
OpenWorldScheme? ow = session.Player.OpenWorlds.Where(x => x.MapId == Data.MapId).FirstOrDefault();
if (ow is not null)
{
ow.Cycle = OpenWorldCycleData.GetInstance().GetNextCycle(Data.MapId, Data.Cycle);
ow.HasTakeFinishRewardCycle = OpenWorldCycleData.GetInstance().GetNextCycle(Data.MapId, Data.Cycle);
}
session.Send(Packet.FromProto(new TakeOpenworldCycleFinishRewardRsp()
{

View File

@@ -1,5 +1,6 @@
using Common.Database;
using Common.Resources.Proto;
using Common.Utils.ExcelReader;
namespace PemukulPaku.GameServer.Handlers.Openworld
{
@@ -9,9 +10,20 @@ namespace PemukulPaku.GameServer.Handlers.Openworld
public void Handle(Session session, Packet packet)
{
TakeOpenworldStoryRewardReq Data = packet.GetDecodedBody<TakeOpenworldStoryRewardReq>();
UserScheme.OpenWorldStoryScheme? ow = session.Player.User.OpenWorldStory.FirstOrDefault(x => x.StoryId == Data.StoryId);
if (ow is not null)
ow.IsDone = true;
UserScheme.OpenWorldStoryScheme? openWorldStory = session.Player.User.OpenWorldStory.FirstOrDefault(x => x.StoryId == Data.StoryId);
if (openWorldStory is not null)
openWorldStory.IsDone = true;
OpenWorldStoryDataExcel? storyData = OpenWorldStoryData.GetInstance().FromId((int)Data.StoryId);
if (storyData is not null)
{
OpenWorldScheme? ow = session.Player.OpenWorlds.Where(x => x.MapId == storyData.StoryMap).FirstOrDefault();
if (ow is not null && OpenWorldStoryData.GetInstance().All.FirstOrDefault(story => story.PreStory.Contains((int)Data.StoryId) && story.StoryMap == storyData.StoryMap)?.Cycle > storyData.Cycle)
{
ow.Cycle = OpenWorldCycleData.GetInstance().GetNextCycle((uint)storyData.StoryMap, (uint)storyData.Cycle);
ow.HasTakeFinishRewardCycle = OpenWorldCycleData.GetInstance().GetNextCycle((uint)storyData.StoryMap, (uint)storyData.Cycle);
}
}
session.Send(Packet.FromProto(new TakeOpenworldStoryRewardRsp() { retcode = TakeOpenworldStoryRewardRsp.Retcode.Succ, StoryId = Data.StoryId }, CmdId.TakeOpenworldStoryRewardRsp));
session.ProcessPacket(Packet.FromProto(new GetOpenworldStoryReq() { }, CmdId.GetOpenworldStoryReq));