diff --git a/Arrowgene.Ddon.GameServer/Characters/ExpManager.cs b/Arrowgene.Ddon.GameServer/Characters/ExpManager.cs index f7011fdfd..45c3bde9f 100644 --- a/Arrowgene.Ddon.GameServer/Characters/ExpManager.cs +++ b/Arrowgene.Ddon.GameServer/Characters/ExpManager.cs @@ -906,13 +906,13 @@ public uint GetScaledPointAmount(RewardSource source, ExpType type, uint amount) switch (type) { case ExpType.ExperiencePoints: - modifier = (source == RewardSource.Enemy) ? _GameSettings.EnemyExpModifier : _GameSettings.QuestExpModifier; + modifier = (source == RewardSource.Enemy) ? _GameSettings.EnemyExpModifier.Value : _GameSettings.QuestExpModifier.Value; break; case ExpType.JobPoints: - modifier = _GameSettings.JpModifier; + modifier = _GameSettings.JpModifier.Value; break; case ExpType.PlayPoints: - modifier = _GameSettings.PpModifier; + modifier = _GameSettings.PpModifier.Value; break; default: modifier = 1.0; diff --git a/Arrowgene.Ddon.GameServer/Characters/RewardManager.cs b/Arrowgene.Ddon.GameServer/Characters/RewardManager.cs index 606bed6e3..a6a9eea34 100644 --- a/Arrowgene.Ddon.GameServer/Characters/RewardManager.cs +++ b/Arrowgene.Ddon.GameServer/Characters/RewardManager.cs @@ -24,7 +24,7 @@ public bool AddQuestRewards(GameClient client, Quest quest, DbConnection? connec var rewards = quest.GenerateBoxRewards(); var currentRewards = GetQuestBoxRewards(client, connectionIn); - if (currentRewards.Count >= _Server.Setting.GameLogicSetting.RewardBoxMax) + if (currentRewards.Count >= _Server.Setting.GameLogicSetting.RewardBoxMax.Value) { return false; } diff --git a/Arrowgene.Ddon.GameServer/Characters/WalletManager.cs b/Arrowgene.Ddon.GameServer/Characters/WalletManager.cs index 91e407be5..f77e0a996 100644 --- a/Arrowgene.Ddon.GameServer/Characters/WalletManager.cs +++ b/Arrowgene.Ddon.GameServer/Characters/WalletManager.cs @@ -107,16 +107,16 @@ public uint GetScaledWalletAmount(WalletType type, uint amount) switch (type) { case WalletType.Gold: - modifier = Server.Setting.GameLogicSetting.GoldModifier; + modifier = Server.Setting.GameLogicSetting.GoldModifier.Value; break; case WalletType.RiftPoints: - modifier = Server.Setting.GameLogicSetting.RiftModifier; + modifier = Server.Setting.GameLogicSetting.RiftModifier.Value; break; case WalletType.BloodOrbs: - modifier = Server.Setting.GameLogicSetting.BoModifier; + modifier = Server.Setting.GameLogicSetting.BoModifier.Value; break; case WalletType.HighOrbs: - modifier = Server.Setting.GameLogicSetting.HoModifier; + modifier = Server.Setting.GameLogicSetting.HoModifier.Value; break; default: modifier = 1.0; diff --git a/Arrowgene.Ddon.GameServer/Handler/InstanceEnemyKillHandler.cs b/Arrowgene.Ddon.GameServer/Handler/InstanceEnemyKillHandler.cs index e891245d0..cb575a332 100644 --- a/Arrowgene.Ddon.GameServer/Handler/InstanceEnemyKillHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/InstanceEnemyKillHandler.cs @@ -209,7 +209,7 @@ public override S2CInstanceEnemyKillRes Handle(GameClient client, C2SInstanceEne if (enemyKilled.BloodOrbs > 0) { // Drop BO - uint gainedBo = (uint) (enemyKilled.BloodOrbs * _gameServer.Setting.GameLogicSetting.BoModifier); + uint gainedBo = (uint) (enemyKilled.BloodOrbs * _gameServer.Setting.GameLogicSetting.BoModifier.Value); uint bonusBo = (uint) (gainedBo * _gameServer.GpCourseManager.EnemyBloodOrbBonus()); CDataUpdateWalletPoint boUpdateWalletPoint = _gameServer.WalletManager.AddToWallet(memberClient.Character, WalletType.BloodOrbs, gainedBo + bonusBo, bonusBo, connectionIn: connectionIn); updateCharacterItemNtc.UpdateWalletList.Add(boUpdateWalletPoint); @@ -218,7 +218,7 @@ public override S2CInstanceEnemyKillRes Handle(GameClient client, C2SInstanceEne if (enemyKilled.HighOrbs > 0) { // Drop HO - uint gainedHo = (uint)(enemyKilled.HighOrbs * _gameServer.Setting.GameLogicSetting.HoModifier); + uint gainedHo = (uint)(enemyKilled.HighOrbs * _gameServer.Setting.GameLogicSetting.HoModifier.Value); CDataUpdateWalletPoint hoUpdateWalletPoint = _gameServer.WalletManager.AddToWallet(memberClient.Character, WalletType.HighOrbs, gainedHo, connectionIn: connectionIn); updateCharacterItemNtc.UpdateWalletList.Add(hoUpdateWalletPoint); } diff --git a/Arrowgene.Ddon.GameServer/Handler/QuestGetCycleContentsStateListHandler.cs b/Arrowgene.Ddon.GameServer/Handler/QuestGetCycleContentsStateListHandler.cs index 9e39b79bd..fe946366c 100644 --- a/Arrowgene.Ddon.GameServer/Handler/QuestGetCycleContentsStateListHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/QuestGetCycleContentsStateListHandler.cs @@ -36,8 +36,8 @@ public override S2CQuestGetCycleContentsStateListRes Handle(GameClient client, C ntc.WorldManageQuestOrderList = pcap.WorldManageQuestOrderList; // Recover paths + change vocation ntc.QuestDefine = pcap.QuestDefine; // Recover quest log data to be able to accept quests - ntc.QuestDefine.OrderMaxNum = Server.Setting.GameLogicSetting.QuestOrderMax; - ntc.QuestDefine.RewardBoxMaxNum = Server.Setting.GameLogicSetting.RewardBoxMax; + ntc.QuestDefine.OrderMaxNum = Server.Setting.GameLogicSetting.QuestOrderMax.Value; + ntc.QuestDefine.RewardBoxMaxNum = Server.Setting.GameLogicSetting.RewardBoxMax.Value; // pcap.MainQuestIdList; (this will add back all missing functionality which depends on complete MSQ) var completedMsq = client.Character.CompletedQuests.Values.Where(x => x.QuestType == QuestType.Main); diff --git a/Arrowgene.Ddon.Server/GameLogicSetting.cs b/Arrowgene.Ddon.Server/GameLogicSetting.cs index c020b1706..936aa137e 100644 --- a/Arrowgene.Ddon.Server/GameLogicSetting.cs +++ b/Arrowgene.Ddon.Server/GameLogicSetting.cs @@ -1,10 +1,30 @@ using Arrowgene.Ddon.Shared.Model; +using System; using System.Collections.Generic; -using System.Configuration; using System.Runtime.Serialization; +using YamlDotNet.Serialization; namespace Arrowgene.Ddon.Server { + [DataContract] + public class DefaultDataMember + { + private T _DefaultValue; + private T? _Value; + + [DataMember] + public T Value { + get => _Value ?? _DefaultValue; + set => _Value = Value; + } + + public DefaultDataMember(T defaultValue) + { + _DefaultValue = defaultValue; + } + } + + [DataContract] public class GameLogicSetting { @@ -167,54 +187,55 @@ public class GameLogicSetting [DataMember(Order = 26)] public bool DisableExpCorrectionForMyPawn { get; set; } /// - /// Global modifier for exp calculations to scale up or down. + /// Global modifier for enemy exp calculations to scale up or down. /// - [DataMember(Order = 27)] public double EnemyExpModifier { get; set; } + [DataMember(Order = 27)] public double? EnemyExpModifier { get; set; } = 1.0; /// /// Global modifier for quest exp calculations to scale up or down. /// - [DataMember(Order = 28)] public double QuestExpModifier { get; set; } + + [DataMember(Order = 28)] public double? QuestExpModifier { get; set; } = 1.0; /// /// Global modifier for pp calculations to scale up or down. /// - [DataMember(Order = 29)] public double PpModifier { get; set; } + [DataMember(Order = 29)] public double? PpModifier { get; set; } = 1.0; /// /// Global modifier for Gold calculations to scale up or down. /// - [DataMember(Order = 30)] public double GoldModifier { get; set; } + [DataMember(Order = 30)] public double? GoldModifier { get; set; } = 1.0; /// /// Global modifier for Rift calculations to scale up or down. /// - [DataMember(Order = 31)] public double RiftModifier { get; set; } + [DataMember(Order = 31)] public double? RiftModifier { get; set; } = 1.0; /// /// Global modifier for BO calculations to scale up or down. /// - [DataMember(Order = 32)] public double BoModifier { get; set; } + [DataMember(Order = 32)] public double? BoModifier { get; set; } = 1.0; /// /// Global modifier for HO calculations to scale up or down. /// - [DataMember(Order = 33)] public double HoModifier { get; set; } + [DataMember(Order = 33)] public double? HoModifier { get; set; } = 1.0; /// /// Global modifier for JP calculations to scale up or down. /// - [DataMember(Order = 34)] public double JpModifier { get; set; } + [DataMember(Order = 34)] public double? JpModifier { get; set; } = 1.0; /// /// Configures the maximum amount of reward box slots. /// - [DataMember(Order = 35)] public byte RewardBoxMax { get; set; } + [DataMember(Order = 35)] public byte? RewardBoxMax { get; set; } = 100; /// /// Configures the maximum amount of quests that can be ordered at one time. /// - [DataMember(Order = 36)] public byte QuestOrderMax { get; set; } + [DataMember(Order = 36)] public byte? QuestOrderMax { get; set; } = 20; /// /// Configures if epitaph rewards are limited once per weekly reset. @@ -310,17 +331,6 @@ public GameLogicSetting() DefaultMaxBazaarExhibits = 5; DefaultWarpFavorites = 3; - EnemyExpModifier = 1.0; - QuestExpModifier = 1.0; - PpModifier = 1.0; - GoldModifier = 1.0; - RiftModifier = 1.0; - BoModifier = 1.0; - HoModifier = 1.0; - JpModifier = 1.0; - RewardBoxMax = 100; - QuestOrderMax = 20; - EnableEpitaphWeeklyRewards = false; EnableMainPartyPawnsQuestRewards = false; @@ -440,6 +450,17 @@ void OnDeserialized(StreamingContext context) UrlChargeB ??= string.Empty; UrlCompanionImage ??= string.Empty; + EnemyExpModifier ??= 1; + QuestExpModifier ??= 1; + PpModifier ??= 1; + GoldModifier ??= 1; + RiftModifier ??= 1; + BoModifier ??= 1; + HoModifier ??= 1; + JpModifier ??= 1; + RewardBoxMax ??= 100; + QuestOrderMax ??= 20; + if (RookiesRingBonus < 0) { RookiesRingBonus = 1.0;