Skip to content

Commit 77dec43

Browse files
authored
Merge pull request #1026 from pacampbell/check_chain_dungeon_packets
feat: Support chain dungeons
2 parents a7c1100 + 905e2ad commit 77dec43

20 files changed

Lines changed: 468 additions & 125 deletions

Arrowgene.Ddon.GameServer/Characters/EpitaphRoadManager.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public EpitaphMysteriousDoorState()
3434
GatheringPoint = new EpitaphGatheringPoint();
3535
}
3636

37-
public SoulOrdealOmState State { get; set; }
37+
public SeasonDungeonOmState State { get; set; }
3838
public EpitaphGatheringPoint GatheringPoint { get; set; }
3939
}
4040

@@ -538,7 +538,7 @@ private void EndTrial(PartyGroup party, EpitaphPartyState partyState, SoulOrdeal
538538
// End Trial
539539
party.SendToAll(new S2CSeasonDungeonEndSoulOrdealNtc() { EndState = endState,
540540
LayoutId = partyState.Trial.StageId.ToCDataStageLayoutId(), PosId = partyState.Trial.PosId,
541-
EpitaphState = ((endState == SoulOrdealEndState.Success) ? SoulOrdealOmState.TrialComplete : SoulOrdealOmState.TrialAvailable)});
541+
EpitaphState = ((endState == SoulOrdealEndState.Success) ? SeasonDungeonOmState.TrialComplete : SeasonDungeonOmState.TrialAvailable)});
542542

543543
if (endState == SoulOrdealEndState.Success)
544544
{
@@ -552,7 +552,7 @@ private void EndTrial(PartyGroup party, EpitaphPartyState partyState, SoulOrdeal
552552
{
553553
LayoutId = unlock.StageId.ToCDataStageLayoutId(),
554554
PosId = unlock.PosId,
555-
State = SoulOrdealOmState.AreaUnlocked
555+
State = SeasonDungeonOmState.AreaUnlocked
556556
});
557557
}
558558
}
@@ -781,37 +781,37 @@ public List<EpitaphBuff> GetPlayerBuffs(GameClient client, PartyGroup party)
781781
}
782782
}
783783

784-
public SoulOrdealOmState GetEpitaphState(GameClient client, StageLayoutId stageId, uint posId)
784+
public SeasonDungeonOmState GetEpitaphState(GameClient client, StageLayoutId stageId, uint posId)
785785
{
786786
lock (_TrialsInProgress)
787787
{
788788
if (!_TrialAssets.Trials.ContainsKey(stageId))
789789
{
790-
return SoulOrdealOmState.Locked;
790+
return SeasonDungeonOmState.Locked;
791791
}
792792

793793
var trial = GetTrial(stageId, posId);
794794
if (trial == null)
795795
{
796-
return SoulOrdealOmState.Locked;
796+
return SeasonDungeonOmState.Locked;
797797
}
798798

799799
if (!IsTrialUnlocked(client.Party, trial))
800800
{
801-
return SoulOrdealOmState.Locked;
801+
return SeasonDungeonOmState.Locked;
802802
}
803803

804804
if (TrialHasRewards(client, stageId, posId))
805805
{
806-
return SoulOrdealOmState.RewardAvailable;
806+
return SeasonDungeonOmState.RewardAvailable;
807807
}
808808

809809
if (!TrialCompleted(client.Party, stageId, posId))
810810
{
811-
return StageManager.IsLegacyEpitaphRoadStageId(stageId) ? SoulOrdealOmState.LegacyTrialAvailable : SoulOrdealOmState.TrialAvailable;
811+
return StageManager.IsLegacyEpitaphRoadStageId(stageId) ? SeasonDungeonOmState.LegacyTrialAvailable : SeasonDungeonOmState.TrialAvailable;
812812
}
813813

814-
return SoulOrdealOmState.RewardReceived;
814+
return SeasonDungeonOmState.RewardReceived;
815815
}
816816
}
817817

@@ -862,7 +862,7 @@ public void AreaChange(GameClient client, uint stageId, PacketQueue queue)
862862
GroupId = omId
863863
},
864864
// TODO: This probably needs a PosId value
865-
State = SoulOrdealOmState.Locked
865+
State = SeasonDungeonOmState.Locked
866866
});
867867
}
868868
}
@@ -876,7 +876,7 @@ public void AreaChange(GameClient client, uint stageId, PacketQueue queue)
876876
{
877877
LayoutId = barrier.StageId.ToCDataStageLayoutId(),
878878
PosId = barrier.PosId,
879-
State = SoulOrdealOmState.Locked
879+
State = SeasonDungeonOmState.Locked
880880
});
881881
}
882882
}
@@ -897,7 +897,7 @@ public void AreaChange(GameClient client, uint stageId, PacketQueue queue)
897897
{
898898
LayoutId = unlock.StageId.ToCDataStageLayoutId(),
899899
PosId = unlock.PosId,
900-
State = SoulOrdealOmState.AreaUnlocked
900+
State = SeasonDungeonOmState.AreaUnlocked
901901
});
902902
}
903903
}
@@ -1068,7 +1068,7 @@ public void HandleStatueUnlock(GameClient client, StageLayoutId stageId, uint po
10681068
{
10691069
LayoutId = stageId.ToCDataStageLayoutId(),
10701070
PosId = posId,
1071-
State = SoulOrdealOmState.AreaUnlocked
1071+
State = SeasonDungeonOmState.AreaUnlocked
10721072
});
10731073
}
10741074

@@ -1101,15 +1101,15 @@ public EpitaphMysteriousDoorState GetMysteriousDoorState(PartyGroup party, Stage
11011101
{
11021102
_DoorState[party.Id][(stageId, posId)] = new EpitaphMysteriousDoorState()
11031103
{
1104-
State = SoulOrdealOmState.DoorLocked
1104+
State = SeasonDungeonOmState.DoorLocked
11051105
};
11061106
}
11071107
}
11081108
return _DoorState[party.Id][(stageId, posId)];
11091109
}
11101110
}
11111111

1112-
public void SetMysteriousDoorState(PartyGroup party, StageLayoutId stageId, uint posId, SoulOrdealOmState state)
1112+
public void SetMysteriousDoorState(PartyGroup party, StageLayoutId stageId, uint posId, SeasonDungeonOmState state)
11131113
{
11141114
lock (_DoorState)
11151115
{
@@ -1166,7 +1166,7 @@ public void SpreadMysteriousPowers(PartyGroup party, StageLayoutId stageId, uint
11661166
party.SendToAll(new S2CSeasonDungeonSetOmStateNtc()
11671167
{
11681168
LayoutId = doorState.GatheringPoint.StageId.ToCDataStageLayoutId(),
1169-
State = SoulOrdealOmState.GatheringPointSpawned
1169+
State = SeasonDungeonOmState.GatheringPointSpawned
11701170
});
11711171
}
11721172
}
@@ -1187,7 +1187,7 @@ private void HandleMysteriousPowerCollection(GameClient client, EpitaphGathering
11871187
return;
11881188
}
11891189

1190-
SetMysteriousDoorState(client.Party, gatheringPoint.Door.StageId, gatheringPoint.Door.PosId, SoulOrdealOmState.DoorUnlocked);
1190+
SetMysteriousDoorState(client.Party, gatheringPoint.Door.StageId, gatheringPoint.Door.PosId, SeasonDungeonOmState.DoorUnlocked);
11911191

11921192
client.Party.SendToAll(new S2C_SEASON_62_28_16_NTC()
11931193
{

Arrowgene.Ddon.GameServer/Characters/QuestManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,15 +3782,15 @@ public static CDataQuestCommand SetQuestEnemyTierUpEx(uint stageNo, int groupNo,
37823782
}
37833783

37843784
/** @brief Sets a body/stance pose (1-6) on a quest NPC/enemy via FUN_00bbf670. */
3785-
public static CDataQuestCommand SetQuestOmMontageFix(uint stageNo, int groupNo, int setNo, int poseId)
3785+
public static CDataQuestCommand SetQuestOmMontageFix(uint stageNo, int groupNo, int setNo, int montagueNo)
37863786
{
3787-
return new CDataQuestCommand() { Command = (ushort)QuestResultCommand.SetQuestOmMontageFix, Param01 = (int)stageNo, Param02 = groupNo, Param03 = setNo, Param04 = poseId };
3787+
return new CDataQuestCommand() { Command = (ushort)QuestResultCommand.SetQuestOmMontageFix, Param01 = (int)stageNo, Param02 = groupNo, Param03 = setNo, Param04 = montagueNo };
37883788
}
37893789

37903790
/** @brief Area-aware variant of AddResultCmdSetQuestOmMontageFix. */
3791-
public static CDataQuestCommand SetQuestOmMontageFixEx(uint stageNo, int groupNo, int setNo, int poseId)
3791+
public static CDataQuestCommand SetQuestOmMontageFixEx(uint stageNo, int groupNo, int setNo, int montagueNo)
37923792
{
3793-
return new CDataQuestCommand() { Command = (ushort)QuestResultCommand.SetQuestOmMontageFixEx, Param01 = (int)stageNo, Param02 = groupNo, Param03 = setNo, Param04 = poseId };
3793+
return new CDataQuestCommand() { Command = (ushort)QuestResultCommand.SetQuestOmMontageFixEx, Param01 = (int)stageNo, Param02 = groupNo, Param03 = setNo, Param04 = montagueNo };
37943794
}
37953795

37963796
/** @brief Sets the level of a layout enemy (type 2) by queuing it into a critical-section-guarded buffer. */

Arrowgene.Ddon.GameServer/Handler/QuestPlayStartTimerHandler.cs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
using Arrowgene.Ddon.GameServer.Characters;
2-
using Arrowgene.Ddon.GameServer.Quests;
32
using Arrowgene.Ddon.Server;
4-
using Arrowgene.Ddon.Server.Network;
53
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
6-
using Arrowgene.Ddon.Shared.Entity.Structure;
7-
using Arrowgene.Ddon.Shared.Model;
8-
using Arrowgene.Ddon.Shared.Model.Quest;
94
using Arrowgene.Logging;
105
using System;
11-
using System.Buffers.Text;
12-
using System.Collections.Generic;
13-
using System.Threading;
14-
using System.Threading.Tasks;
156

167
namespace Arrowgene.Ddon.GameServer.Handler
178
{
@@ -33,13 +24,16 @@ public override S2CQuestPlayStartTimerRes Handle(GameClient client, C2SQuestPlay
3324
}
3425

3526
var quest = QuestManager.GetQuestByBoardId(client.Party.ContentId);
36-
var ntc = new S2CQuestPlayStartTimerNtc()
27+
if (quest.MissionParams.PlaytimeInSeconds > 0)
3728
{
38-
PlayEndDateTime = (ulong)(DateTimeOffset.UtcNow.ToUnixTimeSeconds() + quest.MissionParams.PlaytimeInSeconds)
39-
};
40-
client.Party.SendToAll(ntc);
29+
var ntc = new S2CQuestPlayStartTimerNtc()
30+
{
31+
PlayEndDateTime = (ulong)(DateTimeOffset.UtcNow.ToUnixTimeSeconds() + quest.MissionParams.PlaytimeInSeconds)
32+
};
33+
client.Party.SendToAll(ntc);
4134

42-
Server.PartyQuestContentManager.StartTimer(client.Party.Id, client, quest.MissionParams.PlaytimeInSeconds);
35+
Server.PartyQuestContentManager.StartTimer(client.Party.Id, client, quest.MissionParams.PlaytimeInSeconds);
36+
}
4337

4438
return new S2CQuestPlayStartTimerRes();
4539
}

Arrowgene.Ddon.GameServer/Handler/SeasonDungeon62_40_16_Handler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override void Handle(GameClient client, StructurePacket<C2S_SEASON_62_40_
4141
{
4242
LayoutId = packet.Structure.LayoutId,
4343
PosId = packet.Structure.PosId,
44-
State = SoulOrdealOmState.AreaUnlocked
44+
State = SeasonDungeonOmState.AreaUnlocked
4545
});
4646
}
4747
}
@@ -52,7 +52,7 @@ public override void Handle(GameClient client, StructurePacket<C2S_SEASON_62_40_
5252
{
5353
LayoutId = packet.Structure.LayoutId,
5454
PosId = packet.Structure.PosId,
55-
State = SoulOrdealOmState.Locked
55+
State = SeasonDungeonOmState.Locked
5656
});
5757
}
5858
}

Arrowgene.Ddon.GameServer/Handler/SeasonDungeonDeliverItemForExHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public override S2CSeasonDungeonDeliverItemForExRes Handle(GameClient client, C2
7575
client.Party.SendToAll(new S2CSeasonDungeonSetOmStateNtc()
7676
{
7777
LayoutId = trial.OmLayoutId.ToCDataStageLayoutId(),
78-
State = SoulOrdealOmState.TrialAvailable,
78+
State = SeasonDungeonOmState.TrialAvailable,
7979
});
8080
}
8181
else if (EpitaphId.GetKind(request.EpitaphId) == EpitaphIdKind.Barrier)
@@ -84,7 +84,7 @@ public override S2CSeasonDungeonDeliverItemForExRes Handle(GameClient client, C2
8484
client.Send(new S2CSeasonDungeonSetOmStateNtc()
8585
{
8686
LayoutId = barrier.StageId.ToCDataStageLayoutId(),
87-
State = SoulOrdealOmState.AreaUnlocked
87+
State = SeasonDungeonOmState.AreaUnlocked
8888
});
8989
}
9090

Arrowgene.Ddon.GameServer/Handler/SeasonDungeonGetStatueStateHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public override void Handle(GameClient client, StructurePacket<C2SSeasonDungeonG
2424
{
2525
LayoutId = packet.Structure.LayoutId,
2626
PosId = packet.Structure.PosId,
27-
State = SoulOrdealOmState.AreaUnlocked
27+
State = SeasonDungeonOmState.AreaUnlocked
2828
});
2929
}
3030
}

Arrowgene.Ddon.GameServer/Handler/SeasonDungeonReceiveSoulOrdealRewardHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public override S2CSeasonDungeonReceiveSoulOrdealRewardRes Handle(GameClient cli
2222
{
2323
LayoutId = request.LayoutId,
2424
PosId = request.PosId,
25-
State = SoulOrdealOmState.RewardReceived
25+
State = SeasonDungeonOmState.RewardReceived
2626
});
2727

2828
S2CItemUpdateCharacterItemNtc updateCharacterItemNtc = new S2CItemUpdateCharacterItemNtc()

Arrowgene.Ddon.GameServer/Handler/SeasonDungeonUpdateKeyPointDoorStatusHandler.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Arrowgene.Ddon.GameServer.Characters;
12
using Arrowgene.Ddon.Server;
23
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
34
using Arrowgene.Ddon.Shared.Model.EpitaphRoad;
@@ -15,37 +16,50 @@ public SeasonDungeonUpdateKeyPointDoorStatusHandler(DdonGameServer server) : bas
1516

1617
public override S2CSeasonDungeonUpdateKeyPointDoorStatusRes Handle(GameClient client, C2SSeasonDungeonUpdateKeyPointDoorStatusReq request)
1718
{
18-
Logger.Info($"KeyPointDoor: StageId{request.LayoutId.AsStageLayoutId()}, PosId={request.PosId}");
19+
Logger.Info($"KeyPointDoor: StageId={request.LayoutId.AsStageLayoutId()}, PosId={request.PosId}");
20+
21+
if (!StageManager.IsEpitaphRoadStageId(request.LayoutId.AsStageLayoutId()))
22+
{
23+
// TODO: Implement daily/weekly lockout mechanism
24+
client.Party.SendToAll(new S2CSeasonDungeonSetOmStateNtc()
25+
{
26+
LayoutId = request.LayoutId,
27+
PosId = request.PosId,
28+
State = SeasonDungeonOmState.ChestUnsealed
29+
});
30+
31+
return new S2CSeasonDungeonUpdateKeyPointDoorStatusRes();
32+
}
1933

2034
var doorState = Server.EpitaphRoadManager.GetMysteriousDoorState(client.Party, request.LayoutId.AsStageLayoutId(), request.PosId);
2135

2236
string message = "";
23-
if (doorState.State == SoulOrdealOmState.DoorLocked)
37+
if (doorState.State == SeasonDungeonOmState.DoorLocked)
2438
{
2539
message = "A mysterious power was scattered all around";
26-
Server.EpitaphRoadManager.SetMysteriousDoorState(client.Party, request.LayoutId.AsStageLayoutId(), request.PosId, SoulOrdealOmState.ScatterPowers);
40+
Server.EpitaphRoadManager.SetMysteriousDoorState(client.Party, request.LayoutId.AsStageLayoutId(), request.PosId, SeasonDungeonOmState.ScatterPowers);
2741

2842
client.Party.SendToAll(new S2CSeasonDungeonSetOmStateNtc()
2943
{
3044
LayoutId = request.LayoutId,
3145
PosId = request.PosId,
32-
State = SoulOrdealOmState.ScatterPowers
46+
State = SeasonDungeonOmState.ScatterPowers
3347
});
3448

3549
Server.EpitaphRoadManager.SpreadMysteriousPowers(client.Party, request.LayoutId.AsStageLayoutId(), request.PosId);
3650
}
37-
else if (doorState.State == SoulOrdealOmState.ScatterPowers)
51+
else if (doorState.State == SeasonDungeonOmState.ScatterPowers)
3852
{
3953
message = "Collect scattered powers to unseal the door";
4054
}
41-
else if (doorState.State == SoulOrdealOmState.DoorUnlocked)
55+
else if (doorState.State == SeasonDungeonOmState.DoorUnlocked)
4256
{
4357
message = "The mysterious door has opened";
4458
client.Party.SendToAll(new S2CSeasonDungeonSetOmStateNtc()
4559
{
4660
LayoutId = request.LayoutId,
4761
PosId = request.PosId,
48-
State = SoulOrdealOmState.DoorUnlocked
62+
State = SeasonDungeonOmState.DoorUnlocked
4963
});
5064
}
5165

Arrowgene.Ddon.GameServer/Quests/Extensions/QuestBlockResultCmdExtension.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,15 +404,15 @@ public static QuestBlock AddResultCmdSetQuestEnemyTierUpEx(this QuestBlock quest
404404
return questBlock;
405405
}
406406

407-
public static QuestBlock AddResultCmdSetQuestOmMontageFix(this QuestBlock questBlock, StageInfo stageInfo, int groupNo, int setNo, int poseId)
407+
public static QuestBlock AddResultCmdSetQuestOmMontageFix(this QuestBlock questBlock, StageInfo stageInfo, int groupNo, int setNo, int montagueNo)
408408
{
409-
questBlock.ResultCommands.AddResultCmdSetQuestOmMontageFix(stageInfo, groupNo, setNo, poseId);
409+
questBlock.ResultCommands.AddResultCmdSetQuestOmMontageFix(stageInfo, groupNo, setNo, montagueNo);
410410
return questBlock;
411411
}
412412

413-
public static QuestBlock AddResultCmdSetQuestOmMontageFixEx(this QuestBlock questBlock, StageInfo stageInfo, int groupNo, int setNo, int poseId)
413+
public static QuestBlock AddResultCmdSetQuestOmMontageFixEx(this QuestBlock questBlock, StageInfo stageInfo, int groupNo, int setNo, int montagueNo)
414414
{
415-
questBlock.ResultCommands.AddResultCmdSetQuestOmMontageFixEx(stageInfo, groupNo, setNo, poseId);
415+
questBlock.ResultCommands.AddResultCmdSetQuestOmMontageFixEx(stageInfo, groupNo, setNo, montagueNo);
416416
return questBlock;
417417
}
418418

Arrowgene.Ddon.GameServer/Quests/Extensions/QuestResultCommandExtension.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,15 @@ public static List<CDataQuestCommand> AddResultCmdSetQuestEnemyTierUpEx(this Lis
407407
return resultCommands;
408408
}
409409

410-
public static List<CDataQuestCommand> AddResultCmdSetQuestOmMontageFix(this List<CDataQuestCommand> resultCommands, StageInfo stageInfo, int groupNo, int setNo, int poseId)
410+
public static List<CDataQuestCommand> AddResultCmdSetQuestOmMontageFix(this List<CDataQuestCommand> resultCommands, StageInfo stageInfo, int groupNo, int setNo, int montagueNo)
411411
{
412-
resultCommands.Add(QuestManager.ResultCommand.SetQuestOmMontageFix(stageInfo.StageNo, groupNo, setNo, poseId));
412+
resultCommands.Add(QuestManager.ResultCommand.SetQuestOmMontageFix(stageInfo.StageNo, groupNo, setNo, montagueNo));
413413
return resultCommands;
414414
}
415415

416-
public static List<CDataQuestCommand> AddResultCmdSetQuestOmMontageFixEx(this List<CDataQuestCommand> resultCommands, StageInfo stageInfo, int groupNo, int setNo, int poseId)
416+
public static List<CDataQuestCommand> AddResultCmdSetQuestOmMontageFixEx(this List<CDataQuestCommand> resultCommands, StageInfo stageInfo, int groupNo, int setNo, int montagueNo)
417417
{
418-
resultCommands.Add(QuestManager.ResultCommand.SetQuestOmMontageFixEx(stageInfo.StageNo, groupNo, setNo, poseId));
418+
resultCommands.Add(QuestManager.ResultCommand.SetQuestOmMontageFixEx(stageInfo.StageNo, groupNo, setNo, montagueNo));
419419
return resultCommands;
420420
}
421421

0 commit comments

Comments
 (0)