diff --git a/Arrowgene.Ddon.GameServer/BazaarManager.cs b/Arrowgene.Ddon.GameServer/BazaarManager.cs index 7c6051dcb..2fd5ad086 100644 --- a/Arrowgene.Ddon.GameServer/BazaarManager.cs +++ b/Arrowgene.Ddon.GameServer/BazaarManager.cs @@ -11,10 +11,6 @@ public class BazaarManager { private static readonly double TAXES = 0.05; // 5%, value taken from the ingame menu - // TODO: Make it configurable - private static readonly TimeSpan EXHIBITION_TIME_SPAN = TimeSpan.FromDays(3); - private static readonly TimeSpan COOLDOWN_TIME_SPAN = TimeSpan.FromDays(1); - public BazaarManager(DdonGameServer server) { Server = server; @@ -43,7 +39,7 @@ public ulong Exhibit(GameClient client, StorageType storageType, string itemUID, exhibition.Info.ItemInfo.ExhibitionTime = now; exhibition.Info.State = BazaarExhibitionState.OnSale; exhibition.Info.Proceeds = calculateProceeds(exhibition.Info.ItemInfo.ItemBaseInfo); - exhibition.Info.Expire = now.Add(EXHIBITION_TIME_SPAN); + exhibition.Info.Expire = now.AddSeconds(Server.Setting.GameLogicSetting.BazaarExhibitionTimeSeconds); ulong bazaarId = Server.Database.InsertBazaarExhibition(exhibition); return bazaarId; @@ -63,7 +59,7 @@ public ulong ReExhibit(ulong bazaarId, uint newPrice) exhibition.Info.ItemInfo.ItemBaseInfo.Price = newPrice; exhibition.Info.ItemInfo.ExhibitionTime = now; exhibition.Info.Proceeds = calculateProceeds(exhibition.Info.ItemInfo.ItemBaseInfo); - exhibition.Info.Expire = now.Add(EXHIBITION_TIME_SPAN); + exhibition.Info.Expire = now.AddSeconds(Server.Setting.GameLogicSetting.BazaarExhibitionTimeSeconds); Server.Database.UpdateBazaarExhibiton(exhibition); return exhibition.Info.ItemInfo.BazaarId; @@ -158,7 +154,16 @@ public uint ReceiveProceeds(GameClient client) foreach (BazaarExhibition exhibition in exhibitionsToReceive) { exhibition.Info.State = BazaarExhibitionState.Idle; - exhibition.Info.Expire = now.Add(COOLDOWN_TIME_SPAN); + 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 }; } } diff --git a/Arrowgene.Ddon.Server/GameLogicSetting.cs b/Arrowgene.Ddon.Server/GameLogicSetting.cs index 201e1b75f..5b0ec0f88 100644 --- a/Arrowgene.Ddon.Server/GameLogicSetting.cs +++ b/Arrowgene.Ddon.Server/GameLogicSetting.cs @@ -242,12 +242,25 @@ public class GameLogicSetting /// [DataMember(Order = 37)] public bool? EnableEpitaphWeeklyRewards { get; set; } = true; + /// /// Enables main pawns in party to gain EXP and JP from quests /// Original game apparantly did not have pawns share quest reward, so will set to false for default, /// change as needed /// [DataMember(Order = 38)] public bool EnableMainPartyPawnsQuestRewards { get; set; } + /// + /// Specifies the time in seconds that a bazaar exhibit will last. + /// By default, the equivalent of 3 days + /// + [DataMember(Order = 37)] public ulong BazaarExhibitionTimeSeconds { get; set; } + + /// + /// Specifies the time in seconds that a slot in the bazaar won't be able to be used again. + /// By default, the equivalent of 1 day + /// + [DataMember(Order = 38)] public ulong BazaarCooldownTimeSeconds { get; set; } + /// /// Various URLs used by the client. /// Shared with the login server. @@ -334,6 +347,9 @@ public GameLogicSetting() EnableEpitaphWeeklyRewards = false; EnableMainPartyPawnsQuestRewards = false; + BazaarExhibitionTimeSeconds = (ulong) TimeSpan.FromDays(3).TotalSeconds; + BazaarCooldownTimeSeconds = (ulong) TimeSpan.FromDays(1).TotalSeconds; + string urlDomain = $"http://localhost:{52099}"; UrlManual = $"{urlDomain}/manual_nfb/"; UrlShopDetail = $"{urlDomain}/shop/ingame/stone/detail"; @@ -400,6 +416,9 @@ public GameLogicSetting(GameLogicSetting setting) EnableEpitaphWeeklyRewards = setting.EnableEpitaphWeeklyRewards; EnableMainPartyPawnsQuestRewards = setting.EnableMainPartyPawnsQuestRewards; + BazaarExhibitionTimeSeconds = setting.BazaarExhibitionTimeSeconds; + BazaarCooldownTimeSeconds = setting.BazaarCooldownTimeSeconds; + UrlManual = setting.UrlManual; UrlShopDetail = setting.UrlShopDetail; UrlShopCounterA = setting.UrlShopCounterA;