From a82afba5400d046bdf2e9502a645325c95e3f026 Mon Sep 17 00:00:00 2001 From: alborrajo Date: Thu, 19 Dec 2024 17:47:05 +0100 Subject: [PATCH] Implement bazaar related GP course effects --- Arrowgene.Ddon.GameServer/BazaarManager.cs | 11 ++++++++- .../Characters/GpCourseManager.cs | 24 +++++++++++++++++++ .../BazaarGetExhibitPossibleNumHandler.cs | 4 ++-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Arrowgene.Ddon.GameServer/BazaarManager.cs b/Arrowgene.Ddon.GameServer/BazaarManager.cs index 431b99788..2fd5ad086 100644 --- a/Arrowgene.Ddon.GameServer/BazaarManager.cs +++ b/Arrowgene.Ddon.GameServer/BazaarManager.cs @@ -154,7 +154,16 @@ public uint ReceiveProceeds(GameClient client) foreach (BazaarExhibition exhibition in exhibitionsToReceive) { exhibition.Info.State = BazaarExhibitionState.Idle; - exhibition.Info.Expire = now.AddSeconds(Server.Setting.GameLogicSetting.BazaarCooldownTimeSeconds); + ulong totalCooldown; + try + { + totalCooldown = Server.Setting.GameLogicSetting.BazaarCooldownTimeSeconds - Server.GpCourseManager.BazaarReExhibitShorten(); + } + catch (OverflowException _) + { + totalCooldown = 0; + } + exhibition.Info.Expire = now.AddSeconds(totalCooldown); Server.Database.UpdateBazaarExhibiton(exhibition); } diff --git a/Arrowgene.Ddon.GameServer/Characters/GpCourseManager.cs b/Arrowgene.Ddon.GameServer/Characters/GpCourseManager.cs index b430dbd0d..56f1dec14 100644 --- a/Arrowgene.Ddon.GameServer/Characters/GpCourseManager.cs +++ b/Arrowgene.Ddon.GameServer/Characters/GpCourseManager.cs @@ -35,6 +35,8 @@ internal class CourseBonus public bool DisablePartyExpAdjustment = false; public double EnemyBloodOrbMultiplier = 0.0; public bool InfiniteRevive = false; + public uint BazaarExhibitExtend = 0; + public ulong BazaarReExhibitShorten = 0; }; private void ApplyCourseEffects(uint courseId) @@ -73,6 +75,12 @@ private void ApplyCourseEffects(uint courseId) case GPCourseId.InfiniteRevive: _CourseBonus.InfiniteRevive = true; break; + case GPCourseId.BazaarExhibitExtend: + _CourseBonus.BazaarExhibitExtend += effect.Param0; + break; + case GPCourseId.BazaarReExhibitShorten: + _CourseBonus.BazaarReExhibitShorten += effect.Param0; + break; } } } @@ -250,5 +258,21 @@ public bool InfiniteReviveRefresh() return _CourseBonus.InfiniteRevive; } } + + public uint BazaarExhibitExtend() + { + lock (_CourseBonus) + { + return _CourseBonus.BazaarExhibitExtend; + } + } + + public ulong BazaarReExhibitShorten() + { + lock (_CourseBonus) + { + return _CourseBonus.BazaarReExhibitShorten; + } + } } } diff --git a/Arrowgene.Ddon.GameServer/Handler/BazaarGetExhibitPossibleNumHandler.cs b/Arrowgene.Ddon.GameServer/Handler/BazaarGetExhibitPossibleNumHandler.cs index b6b11e534..d17d0ec56 100644 --- a/Arrowgene.Ddon.GameServer/Handler/BazaarGetExhibitPossibleNumHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/BazaarGetExhibitPossibleNumHandler.cs @@ -16,8 +16,8 @@ public override S2CBazaarGetExhibitPossibleNumRes Handle(GameClient client, C2SB { return new S2CBazaarGetExhibitPossibleNumRes() { - Num = client.Character.MaxBazaarExhibits, - Add = 0 // TODO: Figure out + Num = client.Character.MaxBazaarExhibits + Server.GpCourseManager.BazaarExhibitExtend(), + Add = Server.GpCourseManager.BazaarExhibitExtend() // Not sure what the purpose of this value is }; } }