diff --git a/Arrowgene.Ddon.GameServer/Characters/CraftManager.cs b/Arrowgene.Ddon.GameServer/Characters/CraftManager.cs index e3603fb84..23abda700 100644 --- a/Arrowgene.Ddon.GameServer/Characters/CraftManager.cs +++ b/Arrowgene.Ddon.GameServer/Characters/CraftManager.cs @@ -4,6 +4,7 @@ using Arrowgene.Ddon.Shared.Entity.PacketStructure; using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Ddon.Shared.Model; +using Arrowgene.Ddon.Shared.Model.Craft; using Arrowgene.Logging; namespace Arrowgene.Ddon.GameServer.Characters @@ -35,24 +36,204 @@ public class CraftManager { 8, 16 }, { 16, 21 }, { 21, 26 }, { 26, 31 }, { 31, 36 }, { 36, 41 }, { 41, 46 }, { 46, 51 }, { 51, 56 }, { 56, 61 }, { 61, 66 }, { 66, 71 } }; + /// + /// TODO: Extract to asset + /// + public static readonly List CraftMasterLegendPawnInfoList = new List + { + new CDataRegisteredLegendPawnInfo + { + PawnId = 308, + PointType = WalletType.GoldenGemstones, + RentalCost = 1, + Unk3 = 10000004, + Name = "Many", + CraftRank = 100, + PawnCraftSkillList = new List + { + new CDataPawnCraftSkill + { + Type = CraftSkillType.ProductionSpeed, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.EquipmentEnhancement, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.EquipmentQuality, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.ConsumableQuantity, + Level = 99 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CostPerformance, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.ConsumableProductionIsAlwaysGreatSuccess, + Level = 1 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CreatingHighQualityEquipmentIsAlwaysGreatSuccess, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CostPerformanceEffectUpFactor1, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CostPerformanceEffectUpFactor2, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.UnknownEffect10, + Level = 0 + } + } + }, + new CDataRegisteredLegendPawnInfo + { + PawnId = 309, + PointType = WalletType.GoldenGemstones, + RentalCost = 1, + Unk3 = 10000006, + Name = "Qualio", + CraftRank = 100, + PawnCraftSkillList = new List + { + new CDataPawnCraftSkill + { + Type = CraftSkillType.ProductionSpeed, + Level = 99 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.EquipmentEnhancement, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.EquipmentQuality, + Level = 99 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.ConsumableQuantity, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CostPerformance, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.ConsumableProductionIsAlwaysGreatSuccess, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CreatingHighQualityEquipmentIsAlwaysGreatSuccess, + Level = 1 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CostPerformanceEffectUpFactor1, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CostPerformanceEffectUpFactor2, + Level = 1 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.UnknownEffect10, + Level = 0 + } + } + }, + new CDataRegisteredLegendPawnInfo + { + PawnId = 310, + PointType = WalletType.GoldenGemstones, + RentalCost = 1, + Unk3 = 10000002, + Name = "Arms", + CraftRank = 100, + PawnCraftSkillList = new List + { + new CDataPawnCraftSkill + { + Type = CraftSkillType.ProductionSpeed, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.EquipmentEnhancement, + Level = 99 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.EquipmentQuality, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.ConsumableQuantity, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CostPerformance, + Level = 99 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.ConsumableProductionIsAlwaysGreatSuccess, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CreatingHighQualityEquipmentIsAlwaysGreatSuccess, + Level = 0 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CostPerformanceEffectUpFactor1, + Level = 1 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.CostPerformanceEffectUpFactor2, + Level = 1 + }, + new CDataPawnCraftSkill + { + Type = CraftSkillType.UnknownEffect10, + Level = 0 + } + } + } + }; + private const int GreatSuccessOddsDefault = 10; private const uint CraftSkillLevelMax = 70; private const uint PawnCraftRankMaxLimit = 70; private const double CraftPawnsMax = 4; - /// - /// Randomly chosen maximum of 50% reduction rate. - /// Based on client behavior reduction can not go below a specific unknown threshold for each recipe, e.g. 45sec -> 30sec, but 60sec -> 30sec. - /// - private const uint ProductionSpeedMaximumTotal = 50; - - /// - /// Minimum of 4% reduction added per pawn based on video evidence. - /// - private const uint ProductionSpeedMinimumPerPawn = 4; - - private const double ProductionSpeedIncrementPerLevel = (ProductionSpeedMaximumTotal / CraftPawnsMax - ProductionSpeedMinimumPerPawn) / CraftSkillLevelMax; - /// /// Randomly chosen maximum of 50% chance. /// @@ -103,6 +284,20 @@ public class CraftManager private const double ConsumableQuantityIncrementPerLevel = (ConsumableQuantityMaximumTotal / CraftPawnsMax - ConsumableQuantityMinimumPerPawn) / CraftSkillLevelMax; + /// + /// Used as part of the craft skill calculations. + /// Items of approximately this rank and above apply penalties to the pawns craft skills during crafting. + /// TODO: Expose to settings. + /// + private const uint CraftItemLv = 15; + + /// + /// Used as part of the craft skill calculations. + /// Every ReasonableCraftLv/CraftItemLv item ranks, the penalty increases in magnitude. + /// TODO: Expose to settings. + /// + private const uint ReasonableCraftLv = 5; + private readonly DdonGameServer _server; public CraftManager(DdonGameServer server) @@ -110,35 +305,64 @@ public CraftManager(DdonGameServer server) _server = server; } - #region production speed - /// - /// Calculates crafting time reduction based on an increment per level and ensures a minimum is added for each pawn that is present. - /// Can be manipulated using server setting AdditionalProductionSpeedFactor, which at 1.0 has no effect. + /// Calculates the penalty to craft skills based on the item being crafted. /// - /// + /// /// - public double GetCraftingTimeReductionRate(List productionSpeedLevels) + public static uint ItemDifficultyModifier(ClientItemInfo item) { - return Math.Clamp( - productionSpeedLevels.Select(level => level * ProductionSpeedIncrementPerLevel + ProductionSpeedMinimumPerPawn).Sum() * - _server.Setting.GameLogicSetting.AdditionalProductionSpeedFactor, 0, 100); + if (item.Rank < CraftItemLv) + { + return 0; + } + uint modRank = item.Rank % CraftItemLv; + uint score = (5000 * (item.Rank - modRank) / CraftItemLv) + + (1000 * ReasonableCraftLv * modRank / CraftItemLv) + - 5000; + return score / 1000; } - public uint CalculateRecipeProductionSpeed(uint recipeTime, List productionSpeedLevels) + #region production speed + + /// + /// Calculates crafting time reduction to roughly match the values the client is calculating (plus or minus a few seconds). + /// Can be manipulated using server setting AdditionalProductionSpeedFactor, which at 1.0 has no effect. + /// If AdditionalProductionSpeedFactor isn't 1.0, the actual time will diverge further from the client's predictions. + /// + public uint CalculateRecipeProductionSpeed(uint recipeTime, ClientItemInfo itemInfo, List craftPawns) { - // TODO: Figure out actual formula + lower/upper bounds client uses - double productionSpeedFactor = (100 - GetCraftingTimeReductionRate(productionSpeedLevels)) / 100; - return (uint)Math.Clamp(recipeTime * productionSpeedFactor, 0, recipeTime); + uint difficultyModifier = ItemDifficultyModifier(itemInfo); + int total = 0; + int modifiedTime = (int)recipeTime; + + foreach (var pawn in craftPawns) + { + int effSkill = Math.Max((int)(pawn.ProductionSpeed - difficultyModifier), 0); + PawnCraftSkillSpeedRate speedRateAsset = _server.AssetRepository.PawnCraftSkillSpeedRateAsset.ElementAtOrDefault(effSkill) + ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_SKILL_LEVEL_OVER, $"No speed rate information found for level: {effSkill}"); + float speedRate = pawn.PositionModifier == 1.0 ? speedRateAsset.SpeedRate1 : speedRateAsset.SpeedRate2; + + total += effSkill; + modifiedTime = (int)(modifiedTime * speedRate); + } + + modifiedTime -= total; + if (modifiedTime < 30) + { + modifiedTime = 30; + } + modifiedTime = (int)(modifiedTime * _server.Setting.GameLogicSetting.AdditionalProductionSpeedFactor); + return (uint)modifiedTime; } #endregion #region equipment quality - public static double CalculateEquipmentQualityIncreaseRate(List equipmentQualityLevels) + public static double CalculateEquipmentQualityIncreaseRate(List craftPawns) { - return Math.Clamp(equipmentQualityLevels.Select(level => level * EquipmentQualityIncrementPerLevel + EquipmentQualityMinimumPerPawn).Sum(), 0, 100); + return Math.Clamp(craftPawns.Select(x => x.EquipmentQuality * EquipmentQualityIncrementPerLevel + EquipmentQualityMinimumPerPawn).Sum(), 0, 100); } /// @@ -214,17 +438,17 @@ public static uint CalculateQualityExp(byte itemRank, bool isTier3, bool isTier1 #region equipment enhancement - public static double GetEquipmentEnhancementPoints(List equipmentEnhancementLevels) + public static double GetEquipmentEnhancementPoints(List craftPawns) { - return EquipmentEnhancementMinimumTotal + equipmentEnhancementLevels.Select(level => level * EquipmentEnhancementIncrementPerLevel).Sum(); + return EquipmentEnhancementMinimumTotal + craftPawns.Select(x => x.EquipmentEnhancement * EquipmentEnhancementIncrementPerLevel).Sum(); } - public static double GetEquipmentEnhancementPointsGreatSuccess(List equipmentEnhancementLevels) + public static double GetEquipmentEnhancementPointsGreatSuccess(List craftPawns) { - return GetEquipmentEnhancementPoints(equipmentEnhancementLevels) * EquipmentEnhancementGreatSuccessFactor; + return GetEquipmentEnhancementPoints(craftPawns) * EquipmentEnhancementGreatSuccessFactor; } - public CraftCalculationResult CalculateEquipmentEnhancement(List equipmentEnhancementLevels, uint calculatedOdds) + public CraftCalculationResult CalculateEquipmentEnhancement(List craftPawns, uint calculatedOdds) { // TODO: Figure out actual formula + lower/upper bounds client uses // Based on season 1 evidence: @@ -232,7 +456,7 @@ public CraftCalculationResult CalculateEquipmentEnhancement(List equipment // 1x lvl 45 + 3x lvl 1 => min 266 / max 319 pt // According to wikis: 150 + (levelValue - 1 ) * 1.73 => mostly season 1 - double equipmentEnhancementPoints = GetEquipmentEnhancementPoints(equipmentEnhancementLevels); + double equipmentEnhancementPoints = GetEquipmentEnhancementPoints(craftPawns); bool isGreatSuccess = CalculateIsGreatSuccess(GreatSuccessOddsDefault, calculatedOdds); equipmentEnhancementPoints *= isGreatSuccess ? EquipmentEnhancementGreatSuccessFactor : 1; return new CraftCalculationResult() @@ -246,25 +470,25 @@ public CraftCalculationResult CalculateEquipmentEnhancement(List equipment #region consumable quantity - public static double GetAdditionalConsumableQuantityRate(List consumableQuantityLevels) + public static double GetAdditionalConsumableQuantityRate(List craftPawns) { - return Math.Clamp(consumableQuantityLevels.Select(level => level * ConsumableQuantityIncrementPerLevel + ConsumableQuantityMinimumPerPawn).Sum(), 0, 100); + return Math.Clamp(craftPawns.Select(x => x.ConsumableQuantity * ConsumableQuantityIncrementPerLevel + ConsumableQuantityMinimumPerPawn).Sum(), 0, 100); } - public static double GetAdditionalConsumableQuantityMaximum(List consumableQuantityLevels) + public static double GetAdditionalConsumableQuantityMaximum(List craftPawns) { - return consumableQuantityLevels.Count * ConsumableQuantityMaximumQuantityPerPawn; + return craftPawns.Count * ConsumableQuantityMaximumQuantityPerPawn; } /// /// Takes craft rank and craft skill level of all pawns into account and allows to push the minimum chance to 50% to add up to 3 additional items. /// - public static CraftCalculationResult CalculateConsumableQuantity(List consumableQuantityLevels, uint calculatedOdds) + public static CraftCalculationResult CalculateConsumableQuantity(List craftPawns, uint calculatedOdds) { // TODO: Figure out actual formula + lower/upper bounds client uses - double consumableQuantityChance = GetAdditionalConsumableQuantityRate(consumableQuantityLevels); + double consumableQuantityChance = GetAdditionalConsumableQuantityRate(craftPawns); uint quantity = 0; - for (int i = 0; i < consumableQuantityLevels.Count; i++) + for (int i = 0; i < craftPawns.Count; i++) { quantity += Random.Shared.Next(100) < consumableQuantityChance ? ConsumableQuantityMaximumQuantityPerPawn : 0; } @@ -286,42 +510,43 @@ public static CraftCalculationResult CalculateConsumableQuantity(List cons #region cost performance - public double GetCraftCostReductionRate(List costPerformanceLevels) + public double GetCraftCostReductionRate(ClientItemInfo item, List craftPawns) { - uint total = costPerformanceLevels[0]; - if (_server.AssetRepository.PawnCostReductionAsset.PawnCostReductionInfo.TryGetValue(total, out PawnCostReductionInfo costReductionInfo)) - { - int numberOfPawns = costPerformanceLevels.Count; + uint difficultyModifier = ItemDifficultyModifier(item); + int total = (int)craftPawns + .Where(x => x.CostPerformance > difficultyModifier) + .Sum(x => (x.CostPerformance - difficultyModifier) * x.PositionModifier); - switch (numberOfPawns) - { - case 1: - return costReductionInfo.CostRate1; // TODO: Figure out wtf CostRate2/3/4 Do. - case 2: //If theres 1 Pawn this stuff is accurate, I'm struggling to figure out. - return costReductionInfo.CostRate2; //how to get a 2nd/3rd/4th Pawns calculations accurate based on this dump. - case 3: - return costReductionInfo.CostRate3; - case 4: - return costReductionInfo.CostRate4; - default: - throw new ArgumentOutOfRangeException($"Number of pawns {numberOfPawns} is out of expected range (1-4)."); - } - } - else + PawnCraftSkillCostRate costRateAsset = _server.AssetRepository.PawnCraftSkillCostRateAsset.ElementAtOrDefault(total) + ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_SKILL_LEVEL_OVER, $"No cost reduction information found for total level: {total}"); + + int numberOfPawns = craftPawns.Count; + + switch (numberOfPawns) { - throw new KeyNotFoundException($"No cost reduction information found for total level: {total}"); + case 1: + return costRateAsset.CostRate1; + case 2: + return costRateAsset.CostRate2; + case 3: + return costRateAsset.CostRate3; + case 4: + return costRateAsset.CostRate4; + default: + throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_INTERNAL, $"Number of pawns {numberOfPawns} is out of expected range (1-4)."); } } /// - /// Takes craft skill level of all pawns into account and allows for a maximum of 50% reduction by default. + /// Takes craft skill level of all pawns into account. /// /// Original item recipe's crafting cost. - /// List of cost performance craft skill levels for involved pawns. + /// Item being crafted. + /// List of participating pawns. /// - public uint CalculateRecipeCost(uint recipeCost, List costPerformanceLevels) + public uint CalculateRecipeCost(uint recipeCost, ClientItemInfo item, List craftPawns) { - double discountValue = GetCraftCostReductionRate(costPerformanceLevels) / 100; + double discountValue = GetCraftCostReductionRate(item, craftPawns); double finalCost = discountValue * recipeCost; return (uint)finalCost; } @@ -336,37 +561,6 @@ public static bool CalculateIsGreatSuccess(int baseOdds, uint calculatedOdds) return roll < adjustedOdds; } - - public static uint GetPawnProductionSpeedLevel(Pawn pawn) - { - return GetPawnCraftLevel(pawn, CraftSkillType.ProductionSpeed); - } - - public static uint GetPawnEquipmentEnhancementLevel(Pawn pawn) - { - return GetPawnCraftLevel(pawn, CraftSkillType.EquipmentEnhancement); - } - - public static uint GetPawnEquipmentQualityLevel(Pawn pawn) - { - return GetPawnCraftLevel(pawn, CraftSkillType.EquipmentQuality); - } - - public static uint GetPawnConsumableQuantityLevel(Pawn pawn) - { - return GetPawnCraftLevel(pawn, CraftSkillType.ConsumableQuantity); - } - - public static uint GetPawnCostPerformanceLevel(Pawn pawn) - { - return GetPawnCraftLevel(pawn, CraftSkillType.CostPerformance); - } - - public static uint GetPawnCraftLevel(Pawn pawn, CraftSkillType craftSkillType) - { - return pawn.CraftData.PawnCraftSkillList.Find(skill => skill.Type == craftSkillType).Level; - } - public static bool IsCraftRankLimitPromotionRecipe(Pawn pawn, uint recipeId) { return craftRankLimitPromotionRecipes.ContainsKey(pawn.CraftData.CraftRank) && craftRankLimitPromotionRecipes[pawn.CraftData.CraftRank] == recipeId; @@ -405,7 +599,7 @@ public static uint CalculatePawnRankUp(Pawn pawn) } return rankUps; - } + } public static void HandlePawnRankUpNtc(GameClient client, Pawn leadPawn) { @@ -477,12 +671,9 @@ public static void HandlePawnExpUpNtc(GameClient client, Pawn leadPawn, uint exp public Pawn FindPawn(GameClient client, uint pawnId) { - Pawn pawn = client.Character.Pawns.Find(p => p.PawnId == pawnId); - if (pawn == null) - { - pawn = client.Character.RentedPawns.Find(p => p.PawnId == pawnId); - } - return pawn; + return client.Character.Pawns.Find(p => p.PawnId == pawnId) + ?? client.Character.RentedPawns.Find(p => p.PawnId == pawnId) + ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_PAWN_INVALID, "Couldn't find the Pawn ID."); } } } diff --git a/Arrowgene.Ddon.GameServer/Handler/CraftGetCraftSettingHandler.cs b/Arrowgene.Ddon.GameServer/Handler/CraftGetCraftSettingHandler.cs index fdbff38fc..f654e78b9 100644 --- a/Arrowgene.Ddon.GameServer/Handler/CraftGetCraftSettingHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/CraftGetCraftSettingHandler.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Arrowgene.Ddon.GameServer.Characters; using Arrowgene.Ddon.Server; using Arrowgene.Ddon.Shared.Entity.PacketStructure; using Arrowgene.Ddon.Shared.Entity.Structure; @@ -27,199 +28,6 @@ public class CraftGetCraftSettingHandler : GameStructurePacketHandler - /// TODO: Extract to asset - /// - private static readonly List CraftMasterLegendPawnInfoList = new List - { - new CDataRegisteredLegendPawnInfo - { - PawnId = 308, - PointType = WalletType.GoldenGemstones, - RentalCost = 1, - Unk3 = 10000004, - Name = "Many", - CraftRank = 100, - PawnCraftSkillList = new List - { - new CDataPawnCraftSkill - { - Type = CraftSkillType.ProductionSpeed, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.EquipmentEnhancement, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.EquipmentQuality, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.ConsumableQuantity, - Level = 99 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CostPerformance, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.ConsumableProductionIsAlwaysGreatSuccess, - Level = 1 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CreatingHighQualityEquipmentIsAlwaysGreatSuccess, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CostPerformanceEffectUpFactor1, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CostPerformanceEffectUpFactor2, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.UnknownEffect10, - Level = 0 - } - } - }, - new CDataRegisteredLegendPawnInfo - { - PawnId = 309, - PointType = WalletType.GoldenGemstones, - RentalCost = 1, - Unk3 = 10000006, - Name = "Qualio", - CraftRank = 100, - PawnCraftSkillList = new List - { - new CDataPawnCraftSkill - { - Type = CraftSkillType.ProductionSpeed, - Level = 99 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.EquipmentEnhancement, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.EquipmentQuality, - Level = 99 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.ConsumableQuantity, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CostPerformance, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.ConsumableProductionIsAlwaysGreatSuccess, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CreatingHighQualityEquipmentIsAlwaysGreatSuccess, - Level = 1 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CostPerformanceEffectUpFactor1, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CostPerformanceEffectUpFactor2, - Level = 1 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.UnknownEffect10, - Level = 0 - } - } - }, - new CDataRegisteredLegendPawnInfo - { - PawnId = 310, - PointType = WalletType.GoldenGemstones, - RentalCost = 1, - Unk3 = 10000002, - Name = "Arms", - CraftRank = 100, - PawnCraftSkillList = new List - { - new CDataPawnCraftSkill - { - Type = CraftSkillType.ProductionSpeed, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.EquipmentEnhancement, - Level = 99 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.EquipmentQuality, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.ConsumableQuantity, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CostPerformance, - Level = 99 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.ConsumableProductionIsAlwaysGreatSuccess, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CreatingHighQualityEquipmentIsAlwaysGreatSuccess, - Level = 0 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CostPerformanceEffectUpFactor1, - Level = 1 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.CostPerformanceEffectUpFactor2, - Level = 1 - }, - new CDataPawnCraftSkill - { - Type = CraftSkillType.UnknownEffect10, - Level = 0 - } - } - } - }; - /// /// TODO: Extract to asset /// @@ -382,7 +190,7 @@ public override void Handle(GameClient client, StructurePacket + public class CraftSkillAnalyzeHandler : GameRequestPacketHandler { private static readonly ServerLogger Logger = LogProvider.Logger(typeof(CraftSkillAnalyzeHandler)); @@ -18,55 +18,66 @@ public CraftSkillAnalyzeHandler(DdonGameServer server) : base(server) { } - public override void Handle(GameClient client, StructurePacket packet) + public override S2CCraftSkillAnalyzeRes Handle(GameClient client, C2SCraftSkillAnalyzeReq request) { - List pawnIds = new List { packet.Structure.PawnId }; - pawnIds.AddRange(packet.Structure.AssistPawnIds.Select(p => p.Value)); - - List productionSpeedLevels = new List(); - List equipmentEnhancementLevels = new List(); - List equipmentQualityLevels = new List(); - List consumableQuantityLevels = new List(); - List costPerformanceLevels = new List(); + Pawn leadPawn = Server.CraftManager.FindPawn(client, request.PawnId); - foreach (uint pawnId in pawnIds) + List craftPawns = new() { - Pawn pawn = client.Character.Pawns.Find(p => p.PawnId == pawnId) ?? Server.Database.SelectPawn(pawnId); - productionSpeedLevels.Add(CraftManager.GetPawnProductionSpeedLevel(pawn)); - equipmentEnhancementLevels.Add(CraftManager.GetPawnEquipmentEnhancementLevel(pawn)); - equipmentQualityLevels.Add(CraftManager.GetPawnEquipmentQualityLevel(pawn)); - consumableQuantityLevels.Add(CraftManager.GetPawnConsumableQuantityLevel(pawn)); - costPerformanceLevels.Add(CraftManager.GetPawnCostPerformanceLevel(pawn)); - } + new CraftPawn(leadPawn, CraftPosition.Leader) + }; + craftPawns.AddRange(request.AssistPawnIds.Select(p => new CraftPawn(Server.CraftManager.FindPawn(client, p.Value), CraftPosition.Assistant))); + S2CCraftSkillAnalyzeRes craftSkillAnalyzeRes = new S2CCraftSkillAnalyzeRes(); - switch (packet.Structure.CraftType) + switch (request.CraftType) { // uses different skills depending on recipe type // weapon/armor creation uses 3 / 5 skills: Production Speed, Equipment Quality, Cost Performance // usable item creation uses 3 / 5 skills: Production Speed, Consumable Quantity, Cost Performance // raw material creation uses 2 / 5 skills: Production Speed, Cost Performance // TODO: furniture/special item, currently recipes are missing, cannot check + + // TODO: could be more accurate/improved by figuring out craft category via item category + // ClientItemInfo.GetInfoForItemId(recipe.ItemID).Category + // Note that item id is 0 for craft type CREATE/UPGRADE/QUALITY + // Note that recipe id is 0 for craft type COLOR/ELEMENT case CraftType.CraftTypeCreate: - // TODO: could be more accurate/improved by figuring out craft category via item category - // ClientItemInfo.GetInfoForItemId(recipe.ItemID).Category - // Note that item id is 0 for craft type CREATE/UPGRADE/QUALITY - // Note that recipe id is 0 for craft type COLOR/ELEMENT - // ClientItemInfo item = ClientItemInfo.GetInfoForItemId(Server.AssetRepository.ClientItemInfos, packet.Structure.ItemId); - // CDataMDataCraftRecipe recipe = Server.AssetRepository.CraftingRecipesAsset - // .SelectMany(recipes => recipes.RecipeList) - // .Single(recipe => recipe.RecipeID == packet.Structure.RecipeId); - craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeProductionSpeed(productionSpeedLevels)); - craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeEquipmentQuality(equipmentQualityLevels)); - craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeConsumableQuantity(consumableQuantityLevels)); - craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeCostPerformance(costPerformanceLevels)); - break; + { + CDataMDataCraftRecipe recipe = Server.AssetRepository.CraftingRecipesAsset + .SelectMany(recipes => recipes.RecipeList) + .Single(recipe => recipe.RecipeID == request.RecipeId); + + ClientItemInfo itemInfo = ClientItemInfo.GetInfoForItemId(Server.AssetRepository.ClientItemInfos, recipe.ItemID); + + craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeProductionSpeed(recipe.Time, itemInfo, craftPawns)); + craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeCostPerformance(itemInfo, craftPawns)); + + if (itemInfo.StackLimit > 1) + { + craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeConsumableQuantity(itemInfo, craftPawns)); + } + else if (!CraftStartCraftHandler.NoQualitySubCategories.Contains((ItemSubCategory)itemInfo.SubCategory)) + { + craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeEquipmentQuality(itemInfo, craftPawns)); + } + + break; + } // enhancement uses 2 / 5 skills: Equipment Enhancement, Cost Performance case CraftType.CraftTypeUpgrade: - craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeEquipmentEnhancement(equipmentEnhancementLevels)); - craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeCostPerformance(costPerformanceLevels)); - break; + { + CDataMDataCraftGradeupRecipe recipe = Server.AssetRepository.CraftingGradeUpRecipesAsset + .SelectMany(recipes => recipes.RecipeList) + .First(recipe => recipe.ItemID == request.ItemId); + + ClientItemInfo itemInfo = ClientItemInfo.GetInfoForItemId(Server.AssetRepository.ClientItemInfos, recipe.ItemID); + + craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeEquipmentEnhancement(itemInfo, craftPawns)); + craftSkillAnalyzeRes.AnalyzeResultList.Add(AnalyzeCostPerformance(itemInfo, craftPawns)); + break; + } // element/crest uses 1 / 5 skills: Cost Performance case CraftType.CraftTypeElement: // TODO: client times out for crest/color, maybe because assistants are not allowed and only a single result is expected? @@ -79,12 +90,17 @@ public override void Handle(GameClient client, StructurePacket @@ -92,12 +108,16 @@ public override void Handle(GameClient client, StructurePacket /// /// - private CDataCraftSkillAnalyzeResult AnalyzeProductionSpeed(List productionSpeedLevel) + private CDataCraftSkillAnalyzeResult AnalyzeProductionSpeed(uint recipeTime, ClientItemInfo itemInfo, List craftPawns) { + uint reducedTime = Server.CraftManager.CalculateRecipeProductionSpeed(recipeTime, itemInfo, craftPawns); + uint deltaTime = recipeTime - reducedTime; + byte timeFactor = (byte)(deltaTime * 100.0 / reducedTime); + CDataCraftSkillAnalyzeResult productionSpeedAnalysisResult = new CDataCraftSkillAnalyzeResult { SkillType = CraftSkillType.ProductionSpeed, - Rate = (byte)Server.CraftManager.GetCraftingTimeReductionRate(productionSpeedLevel) + Rate = timeFactor }; return productionSpeedAnalysisResult; } @@ -107,12 +127,12 @@ private CDataCraftSkillAnalyzeResult AnalyzeProductionSpeed(List productio /// /// /// - private CDataCraftSkillAnalyzeResult AnalyzeEquipmentQuality(List equipmentQualityLevel) + private CDataCraftSkillAnalyzeResult AnalyzeEquipmentQuality(ClientItemInfo itemInfo, List craftPawns) { CDataCraftSkillAnalyzeResult equipmentQualityAnalysisResult = new CDataCraftSkillAnalyzeResult { SkillType = CraftSkillType.EquipmentQuality, - Rate = (byte)CraftManager.CalculateEquipmentQualityIncreaseRate(equipmentQualityLevel) + Rate = (byte)CraftManager.CalculateEquipmentQualityIncreaseRate(craftPawns) }; return equipmentQualityAnalysisResult; } @@ -122,13 +142,13 @@ private CDataCraftSkillAnalyzeResult AnalyzeEquipmentQuality(List equipmen /// /// /// - private CDataCraftSkillAnalyzeResult AnalyzeEquipmentEnhancement(List equipmentEnhancementLevels) + private CDataCraftSkillAnalyzeResult AnalyzeEquipmentEnhancement(ClientItemInfo itemInfo, List craftPawns) { CDataCraftSkillAnalyzeResult equipEnhancementAnalysisResult = new CDataCraftSkillAnalyzeResult { SkillType = CraftSkillType.EquipmentEnhancement, - Value0 = (uint)CraftManager.GetEquipmentEnhancementPoints(equipmentEnhancementLevels), - Value1 = (uint)CraftManager.GetEquipmentEnhancementPointsGreatSuccess(equipmentEnhancementLevels) + Value0 = (uint)CraftManager.GetEquipmentEnhancementPoints(craftPawns), + Value1 = (uint)CraftManager.GetEquipmentEnhancementPointsGreatSuccess(craftPawns) }; return equipEnhancementAnalysisResult; } @@ -138,13 +158,13 @@ private CDataCraftSkillAnalyzeResult AnalyzeEquipmentEnhancement(List equi /// /// /// - private CDataCraftSkillAnalyzeResult AnalyzeConsumableQuantity(List consumableQuantityLevels) + private CDataCraftSkillAnalyzeResult AnalyzeConsumableQuantity(ClientItemInfo itemInfo, List craftPawns) { CDataCraftSkillAnalyzeResult consumableQuantityAnalysisResult = new CDataCraftSkillAnalyzeResult { SkillType = CraftSkillType.ConsumableQuantity, - Rate = (byte)CraftManager.GetAdditionalConsumableQuantityRate(consumableQuantityLevels), - Value0 = (byte)CraftManager.GetAdditionalConsumableQuantityMaximum(consumableQuantityLevels) + Rate = (byte)CraftManager.GetAdditionalConsumableQuantityRate(craftPawns), + Value0 = (byte)CraftManager.GetAdditionalConsumableQuantityMaximum(craftPawns) }; return consumableQuantityAnalysisResult; } @@ -154,12 +174,12 @@ private CDataCraftSkillAnalyzeResult AnalyzeConsumableQuantity(List consum /// /// /// - private CDataCraftSkillAnalyzeResult AnalyzeCostPerformance(List costPerformanceLevels) + private CDataCraftSkillAnalyzeResult AnalyzeCostPerformance(ClientItemInfo itemInfo, List craftPawns) { CDataCraftSkillAnalyzeResult costPerformanceAnalysisResult = new CDataCraftSkillAnalyzeResult { SkillType = CraftSkillType.CostPerformance, - Rate = (byte)Server.CraftManager.GetCraftCostReductionRate(costPerformanceLevels) + Rate = (byte)(100.0 - Server.CraftManager.GetCraftCostReductionRate(itemInfo, craftPawns) * 100.0) }; return costPerformanceAnalysisResult; } diff --git a/Arrowgene.Ddon.GameServer/Handler/CraftStartAttachElementHandler.cs b/Arrowgene.Ddon.GameServer/Handler/CraftStartAttachElementHandler.cs index e657a7250..bd1f4782d 100644 --- a/Arrowgene.Ddon.GameServer/Handler/CraftStartAttachElementHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/CraftStartAttachElementHandler.cs @@ -6,6 +6,7 @@ using Arrowgene.Ddon.Shared.Entity.PacketStructure; using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Ddon.Shared.Model; +using Arrowgene.Ddon.Shared.Model.Craft; using Arrowgene.Logging; namespace Arrowgene.Ddon.GameServer.Handler @@ -79,24 +80,16 @@ public override S2CCraftStartAttachElementRes Handle(GameClient client, C2SCraft Pawn leadPawn = Server.CraftManager.FindPawn(client, request.CraftMainPawnId); - List pawns = new List { leadPawn }; - pawns.AddRange(request.CraftSupportPawnIDList.Select(p => Server.CraftManager.FindPawn(client, p.PawnId))); - List costPerformanceLevels = new List(); - foreach (Pawn pawn in pawns) + List craftPawns = new() { - if (pawn != null) - { - costPerformanceLevels.Add(CraftManager.GetPawnCostPerformanceLevel(pawn)); - } - else - { - throw new ResponseErrorException(ErrorCode.ERROR_CODE_PAWN_INVALID, "Couldn't find the Pawn ID."); - } - } - + new CraftPawn(leadPawn, CraftPosition.Leader) + }; + craftPawns.AddRange(request.CraftSupportPawnIDList.Select(p => new CraftPawn(Server.CraftManager.FindPawn(client, p.PawnId), CraftPosition.Assistant))); + + updateCharacterItemNtc.UpdateType = ItemNoticeType.StartAttachElement; CDataUpdateWalletPoint updateWalletPoint = Server.WalletManager.RemoveFromWallet(client.Character, WalletType.Gold, - Server.CraftManager.CalculateRecipeCost(totalCost, costPerformanceLevels)) + Server.CraftManager.CalculateRecipeCost(totalCost, clientItemInfo, craftPawns)) ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_INTERNAL, "Insufficient gold."); diff --git a/Arrowgene.Ddon.GameServer/Handler/CraftStartCraftHandler.cs b/Arrowgene.Ddon.GameServer/Handler/CraftStartCraftHandler.cs index 5e67cbea3..895eeb8b7 100644 --- a/Arrowgene.Ddon.GameServer/Handler/CraftStartCraftHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/CraftStartCraftHandler.cs @@ -7,6 +7,7 @@ using Arrowgene.Ddon.Shared.Entity.PacketStructure; using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Ddon.Shared.Model; +using Arrowgene.Ddon.Shared.Model.Craft; using Arrowgene.Logging; namespace Arrowgene.Ddon.GameServer.Handler @@ -15,7 +16,7 @@ public class CraftStartCraftHandler : GameRequestPacketHandler(typeof(CraftStartCraftHandler)); - private static readonly HashSet BannedSubCategories = new() + public static readonly HashSet NoQualitySubCategories = new() { ItemSubCategory.WeaponShield, ItemSubCategory.WeaponRod, @@ -46,13 +47,11 @@ public override S2CCraftStartCraftRes Handle(GameClient client, C2SCraftStartCra } catch (InvalidOperationException) { - Logger.Error($"Duplicate recipe ID {request.RecipeID}!!!"); throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_RECIPE_NOT_FOUND, $"Duplicate recipe ID {request.RecipeID}"); } ClientItemInfo itemInfo = ClientItemInfo.GetInfoForItemId(Server.AssetRepository.ClientItemInfos, recipe.ItemID); - ushort AddStatusID = request.AdditionalStatusId; CDataAddStatusParam AddStat = new CDataAddStatusParam() { @@ -63,8 +62,20 @@ public override S2CCraftStartCraftRes Handle(GameClient client, C2SCraftStartCra }; List AddStatList = new List(); - S2CItemUpdateCharacterItemNtc updateCharacterItemNtc = new S2CItemUpdateCharacterItemNtc(); - updateCharacterItemNtc.UpdateType = ItemNoticeType.StartCraft; + S2CItemUpdateCharacterItemNtc updateCharacterItemNtc = new S2CItemUpdateCharacterItemNtc() + { + UpdateType = ItemNoticeType.StartCraft + }; + + Pawn leadPawn = Server.CraftManager.FindPawn(client, request.CraftMainPawnID); + + List craftPawns = new() + { + new CraftPawn(leadPawn, CraftPosition.Leader) + }; + craftPawns.AddRange(request.CraftSupportPawnIDList.Select(p => new CraftPawn(Server.CraftManager.FindPawn(client, p.PawnId), CraftPosition.Assistant))); + craftPawns.AddRange(request.CraftMasterLegendPawnIDList.Select(p => new CraftPawn(CraftManager.CraftMasterLegendPawnInfoList.Single(m => m.PawnId == p.PawnId)))); + Server.Database.ExecuteInTransaction(connection => { // Remove crafting materials @@ -82,32 +93,10 @@ public override S2CCraftStartCraftRes Handle(GameClient client, C2SCraftStartCra } } - Pawn leadPawn = Server.CraftManager.FindPawn(client, request.CraftMainPawnID); - List pawns = new List { leadPawn }; - pawns.AddRange(request.CraftSupportPawnIDList.Select(p => Server.CraftManager.FindPawn(client, p.PawnId))); - List productionSpeedLevels = new List(); - List consumableQuantityLevels = new List(); - List costPerformanceLevels = new List(); - List qualityLevels = new List(); - foreach (Pawn pawn in pawns) - { - if (pawn != null) - { - productionSpeedLevels.Add(CraftManager.GetPawnProductionSpeedLevel(pawn)); - consumableQuantityLevels.Add(CraftManager.GetPawnConsumableQuantityLevel(pawn)); - costPerformanceLevels.Add(CraftManager.GetPawnCostPerformanceLevel(pawn)); - qualityLevels.Add(CraftManager.GetPawnEquipmentQualityLevel(pawn)); - } - else - { - throw new ResponseErrorException(ErrorCode.ERROR_CODE_PAWN_INVALID, "Couldn't find the Pawn ID."); - } - } - - double calculatedOdds = CraftManager.CalculateEquipmentQualityIncreaseRate(qualityLevels); + double calculatedOdds = CraftManager.CalculateEquipmentQualityIncreaseRate(craftPawns); uint plusValue = 0; bool isGreatSuccessEquipmentQuality = false; - bool canPlusValue = !itemInfo.SubCategory.HasValue || !BannedSubCategories.Contains(itemInfo.SubCategory.Value); + bool canPlusValue = !itemInfo.SubCategory.HasValue || !NoQualitySubCategories.Contains(itemInfo.SubCategory.Value); if (canPlusValue && !string.IsNullOrEmpty(request.RefineMaterialUID)) { Item refineMaterialItem = Server.Database.SelectStorageItemByUId(request.RefineMaterialUID); @@ -131,7 +120,7 @@ public override S2CCraftStartCraftRes Handle(GameClient client, C2SCraftStartCra bool isGreatSuccessConsumableQuantity = false; if (itemInfo.StorageType == StorageType.ItemBagConsumable) { - CraftCalculationResult craftCalculationResult = CraftManager.CalculateConsumableQuantity(consumableQuantityLevels, (uint)calculatedOdds); + CraftCalculationResult craftCalculationResult = CraftManager.CalculateConsumableQuantity(craftPawns, (uint)calculatedOdds); consumableAdditionalQuantity = request.CreateCount * craftCalculationResult.CalculatedValue; isGreatSuccessConsumableQuantity = craftCalculationResult.IsGreatSuccess; } @@ -148,7 +137,7 @@ public override S2CCraftStartCraftRes Handle(GameClient client, C2SCraftStartCra ItemId = recipe.ItemID, AdditionalStatusId = request.AdditionalStatusId, // TODO: implement mechanism to deduct time periodically - RemainTime = Server.CraftManager.CalculateRecipeProductionSpeed(recipe.Time, productionSpeedLevels), + RemainTime = Server.CraftManager.CalculateRecipeProductionSpeed(recipe.Time, itemInfo, craftPawns), CreateCount = recipe.Num * request.CreateCount, PlusValue = plusValue, GreatSuccess = isGreatSuccessEquipmentQuality || isGreatSuccessConsumableQuantity, @@ -178,9 +167,17 @@ public override S2CCraftStartCraftRes Handle(GameClient client, C2SCraftStartCra // Subtract craft price CDataUpdateWalletPoint updateWalletPoint = Server.WalletManager.RemoveFromWallet(client.Character, WalletType.Gold, - Server.CraftManager.CalculateRecipeCost(recipe.Cost, costPerformanceLevels) * request.CreateCount, connection) + Server.CraftManager.CalculateRecipeCost(recipe.Cost, itemInfo, craftPawns) * request.CreateCount, connection) ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_INTERNAL, "Insufficient gold."); updateCharacterItemNtc.UpdateWalletList.Add(updateWalletPoint); + + if (request.CraftMasterLegendPawnIDList.Count > 0) + { + uint totalGPcost = (uint)request.CraftMasterLegendPawnIDList.Sum(p => CraftManager.CraftMasterLegendPawnInfoList.Single(m => m.PawnId == p.PawnId).RentalCost); + CDataUpdateWalletPoint updateGP = Server.WalletManager.RemoveFromWallet(client.Character, WalletType.GoldenGemstones, totalGPcost) + ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_GP_LACK_GP); + updateCharacterItemNtc.UpdateWalletList.Add(updateGP); + } }); client.Send(updateCharacterItemNtc); diff --git a/Arrowgene.Ddon.GameServer/Handler/CraftStartEquipColorChangeHandler.cs b/Arrowgene.Ddon.GameServer/Handler/CraftStartEquipColorChangeHandler.cs index 99dd5d417..e2db1e192 100644 --- a/Arrowgene.Ddon.GameServer/Handler/CraftStartEquipColorChangeHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/CraftStartEquipColorChangeHandler.cs @@ -7,6 +7,7 @@ using Arrowgene.Ddon.Shared.Entity.PacketStructure; using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Ddon.Shared.Model; +using Arrowgene.Ddon.Shared.Model.Craft; using Arrowgene.Logging; namespace Arrowgene.Ddon.GameServer.Handler @@ -114,24 +115,14 @@ public override S2CCraftStartEquipColorChangeRes Handle(GameClient client, C2SCr uint pawnExp = craftInfo.Exp; Pawn leadPawn = Server.CraftManager.FindPawn(client, request.CraftMainPawnID); - List pawns = new List { leadPawn }; - pawns.AddRange(request.CraftSupportPawnIDList.Select(p => Server.CraftManager.FindPawn(client, p.PawnId))); - List costPerformanceLevels = new List(); - - foreach (Pawn pawn in pawns) + List craftPawns = new() { - if (pawn != null) - { - costPerformanceLevels.Add(CraftManager.GetPawnCostPerformanceLevel(pawn)); - } - else - { - throw new ResponseErrorException(ErrorCode.ERROR_CODE_PAWN_INVALID, "Couldn't find the Pawn ID."); - } - } + new CraftPawn(leadPawn, CraftPosition.Leader) + }; + craftPawns.AddRange(request.CraftSupportPawnIDList.Select(p => new CraftPawn(Server.CraftManager.FindPawn(client, p.PawnId), CraftPosition.Assistant))); CDataUpdateWalletPoint updateWalletPoint = Server.WalletManager.RemoveFromWallet(client.Character, WalletType.Gold, - Server.CraftManager.CalculateRecipeCost(totalCost, costPerformanceLevels)) + Server.CraftManager.CalculateRecipeCost(totalCost, clientItemInfo, craftPawns)) ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_INTERNAL, "Insufficient gold."); updateCharacterItemNtc.UpdateWalletList.Add(updateWalletPoint); client.Send(updateCharacterItemNtc); diff --git a/Arrowgene.Ddon.GameServer/Handler/CraftStartEquipGradeUpHandler.cs b/Arrowgene.Ddon.GameServer/Handler/CraftStartEquipGradeUpHandler.cs index 586e015ed..12ee13eae 100644 --- a/Arrowgene.Ddon.GameServer/Handler/CraftStartEquipGradeUpHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/CraftStartEquipGradeUpHandler.cs @@ -7,6 +7,7 @@ using Arrowgene.Ddon.Shared.Entity.PacketStructure; using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Ddon.Shared.Model; +using Arrowgene.Ddon.Shared.Model.Craft; using Arrowgene.Logging; @@ -32,6 +33,7 @@ public override S2CCraftStartEquipGradeUpRes Handle(GameClient client, C2SCraftS Item equipItem = ramItem.Item2.Item2; uint charid = client.Character.CharacterId; uint craftpawnid = request.CraftMainPawnID; + ClientItemInfo itemInfo = ClientItemInfo.GetInfoForItemId(Server.AssetRepository.ClientItemInfos, equipItem.ItemId); // Fetch the crafting recipe data for the item CDataMDataCraftGradeupRecipe recipeData = Server.AssetRepository.CraftingGradeUpRecipesAsset @@ -77,40 +79,36 @@ public override S2CCraftStartEquipGradeUpRes Handle(GameClient client, C2SCraftS } } + Pawn leadPawn = Server.CraftManager.FindPawn(client, request.CraftMainPawnID); - List pawns = new List { leadPawn }; - pawns.AddRange(request.CraftSupportPawnIDList.Select(p => Server.CraftManager.FindPawn(client, p.PawnId))); - List enhancementLevels = new List(); - List costPerformanceLevels = new List(); - List qualityLevels = new List(); - foreach (Pawn pawn in pawns) + List craftPawns = new() { - if (pawn != null) - { - enhancementLevels.Add(CraftManager.GetPawnEquipmentEnhancementLevel(pawn)); - costPerformanceLevels.Add(CraftManager.GetPawnCostPerformanceLevel(pawn)); - qualityLevels.Add(CraftManager.GetPawnEquipmentQualityLevel(pawn)); - } - else - { - throw new ResponseErrorException(ErrorCode.ERROR_CODE_PAWN_INVALID, "Couldn't find the Pawn ID."); - } - } + new CraftPawn(leadPawn, CraftPosition.Leader) + }; + craftPawns.AddRange(request.CraftSupportPawnIDList.Select(p => new CraftPawn(Server.CraftManager.FindPawn(client, p.PawnId), CraftPosition.Assistant))); + craftPawns.AddRange(request.CraftMasterLegendPawnIDList.Select(p => new CraftPawn(CraftManager.CraftMasterLegendPawnInfoList.Single(m => m.PawnId == p.PawnId)))); - double calculatedOdds = CraftManager.CalculateEquipmentQualityIncreaseRate(qualityLevels); - CraftCalculationResult enhnacementResult = _craftManager.CalculateEquipmentEnhancement(enhancementLevels, (uint)calculatedOdds); + double calculatedOdds = CraftManager.CalculateEquipmentQualityIncreaseRate(craftPawns); + CraftCalculationResult enhnacementResult = _craftManager.CalculateEquipmentEnhancement(craftPawns, (uint)calculatedOdds); bool isGreatSuccess = enhnacementResult.IsGreatSuccess; uint addEquipPoint = enhnacementResult.CalculatedValue; currentTotalEquipPoint += addEquipPoint; CDataUpdateWalletPoint updateWalletPoint = Server.WalletManager.RemoveFromWallet(client.Character, WalletType.Gold, - Server.CraftManager.CalculateRecipeCost(recipeData.Cost, costPerformanceLevels)) + Server.CraftManager.CalculateRecipeCost(recipeData.Cost, itemInfo, craftPawns)) ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_INTERNAL, "Insufficient gold."); updateCharacterItemNtc.UpdateWalletList.Add(updateWalletPoint); - ClientItemInfo itemInfo = ClientItemInfo.GetInfoForItemId(Server.AssetRepository.ClientItemInfos, equipItem.ItemId); + if (request.CraftMasterLegendPawnIDList.Count > 0) + { + uint totalGPcost = (uint)request.CraftMasterLegendPawnIDList.Sum(p => CraftManager.CraftMasterLegendPawnInfoList.Single(m => m.PawnId == p.PawnId).RentalCost); + CDataUpdateWalletPoint updateGP = Server.WalletManager.RemoveFromWallet(client.Character, WalletType.GoldenGemstones, totalGPcost) + ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_GP_LACK_GP); + updateCharacterItemNtc.UpdateWalletList.Add(updateGP); + } + byte currentStars = (byte)itemInfo.Quality; uint remainingPoints = currentTotalEquipPoint; List gradeupList = new List(); diff --git a/Arrowgene.Ddon.GameServer/Handler/CraftStartQualityUpHandler.cs b/Arrowgene.Ddon.GameServer/Handler/CraftStartQualityUpHandler.cs index 5472bfadd..2e9db5b4a 100644 --- a/Arrowgene.Ddon.GameServer/Handler/CraftStartQualityUpHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/CraftStartQualityUpHandler.cs @@ -7,6 +7,7 @@ using Arrowgene.Ddon.Shared.Entity.PacketStructure; using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Ddon.Shared.Model; +using Arrowgene.Ddon.Shared.Model.Craft; using Arrowgene.Logging; namespace Arrowgene.Ddon.GameServer.Handler @@ -32,7 +33,6 @@ public override S2CCraftStartQualityUpRes Handle(GameClient client, C2SCraftStar string RefineMaterialUID = request.RefineUID; ushort AddStatusID = request.AddStatusID; uint pawnExp = 0; - ClientItemInfo clientItemInfo = ClientItemInfo.GetInfoForItemId(Server.AssetRepository.ClientItemInfos, equipItem.ItemId); uint totalCost = Math.Min(100, (uint)itemRank) * 300; List updateResults; S2CItemUpdateCharacterItemNtc updateCharacterItemNtc = new S2CItemUpdateCharacterItemNtc(); @@ -58,26 +58,15 @@ public override S2CCraftStartQualityUpRes Handle(GameClient client, C2SCraftStar // Lead pawn is always owned by player. Pawn leadPawn = Server.CraftManager.FindPawn(client, request.CraftMainPawnID); - List pawns = new List { leadPawn }; - pawns.AddRange(request.CraftSupportPawnIDList.Select(p => Server.CraftManager.FindPawn(client, p.PawnId))); - List qualityLevels = new List(); - List costPerformanceLevels = new List(); - foreach (Pawn pawn in pawns) + List craftPawns = new() { - if (pawn != null) - { - costPerformanceLevels.Add(CraftManager.GetPawnCostPerformanceLevel(pawn)); - qualityLevels.Add(CraftManager.GetPawnEquipmentQualityLevel(pawn)); - } - else - { - throw new ResponseErrorException(ErrorCode.ERROR_CODE_PAWN_INVALID, "Couldn't find the Pawn ID."); - } - - } - double calculatedOdds = CraftManager.CalculateEquipmentQualityIncreaseRate(qualityLevels); + new CraftPawn(leadPawn, CraftPosition.Leader) + }; + craftPawns.AddRange(request.CraftSupportPawnIDList.Select(p => new CraftPawn(Server.CraftManager.FindPawn(client, p.PawnId), CraftPosition.Assistant))); + craftPawns.AddRange(request.CraftMasterLegendPawnIDList.Select(p => new CraftPawn(CraftManager.CraftMasterLegendPawnInfoList.Single(m => m.PawnId == p.PawnId)))); + double calculatedOdds = CraftManager.CalculateEquipmentQualityIncreaseRate(craftPawns); uint plusValue = 0; bool isGreatSuccessEquipmentQuality = false; @@ -155,10 +144,18 @@ public override S2CCraftStartQualityUpRes Handle(GameClient client, C2SCraftStar } CDataUpdateWalletPoint updateWalletPoint = Server.WalletManager.RemoveFromWallet(client.Character, WalletType.Gold, - Server.CraftManager.CalculateRecipeCost(totalCost, costPerformanceLevels)) + Server.CraftManager.CalculateRecipeCost(totalCost, itemInfo, craftPawns)) ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_INTERNAL, "Insufficient gold."); updateCharacterItemNtc.UpdateWalletList.Add(updateWalletPoint); + if (request.CraftMasterLegendPawnIDList.Count > 0) + { + uint totalGPcost = (uint)request.CraftMasterLegendPawnIDList.Sum(p => CraftManager.CraftMasterLegendPawnInfoList.Single(m => m.PawnId == p.PawnId).RentalCost); + CDataUpdateWalletPoint updateGP = Server.WalletManager.RemoveFromWallet(client.Character, WalletType.GoldenGemstones, totalGPcost) + ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_GP_LACK_GP); + updateCharacterItemNtc.UpdateWalletList.Add(updateGP); + } + var res = new S2CCraftStartQualityUpRes() { Unk0 = dummydata, diff --git a/Arrowgene.Ddon.Shared/Asset/PawnCostReductionAsset.cs b/Arrowgene.Ddon.Shared/Asset/PawnCostReductionAsset.cs deleted file mode 100644 index 63447ac7d..000000000 --- a/Arrowgene.Ddon.Shared/Asset/PawnCostReductionAsset.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections.Generic; -using Arrowgene.Ddon.Shared.Model; - -namespace Arrowgene.Ddon.Shared.Asset -{ - public class PawnCostReductionAsset - { - public PawnCostReductionAsset() - { - PawnCostReductionInfo = new Dictionary(); - } - - public Dictionary PawnCostReductionInfo { get; set; } - } -} diff --git a/Arrowgene.Ddon.Shared/AssetReader/PawnCostReductionAssetDeserializer.cs b/Arrowgene.Ddon.Shared/AssetReader/PawnCostReductionAssetDeserializer.cs deleted file mode 100644 index 8c13d74fa..000000000 --- a/Arrowgene.Ddon.Shared/AssetReader/PawnCostReductionAssetDeserializer.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.Json; -using Arrowgene.Ddon.Shared.Model; -using Arrowgene.Logging; -using Arrowgene.Ddon.Shared.Asset; - -namespace Arrowgene.Ddon.Shared.AssetReader -{ - public class PawnCostReductionAssetDeserializer : IAssetDeserializer - { - private static readonly ILogger Logger = LogProvider.Logger(typeof(PawnCostReductionAssetDeserializer)); - - public PawnCostReductionAsset ReadPath(string path) - { - Logger.Info($"Reading {path}"); - - var asset = new PawnCostReductionAsset(); - - string json = File.ReadAllText(path); - using (JsonDocument document = JsonDocument.Parse(json)) - { - var costReductionElements = document.RootElement.EnumerateArray().ToList(); - foreach (var element in costReductionElements) - { - uint total = element.GetProperty("Total").GetUInt32(); - float costRate1 = element.GetProperty("CostRate1").GetSingle(); - float costRate2 = element.GetProperty("CostRate2").GetSingle(); - float costRate3 = element.GetProperty("CostRate3").GetSingle(); - float costRate4 = element.GetProperty("CostRate4").GetSingle(); - - // In this example, `Total` is used as the key for the dictionary - asset.PawnCostReductionInfo[total] = new PawnCostReductionInfo() - { - Total = total, - CostRate1 = costRate1, - CostRate2 = costRate2, - CostRate3 = costRate3, - CostRate4 = costRate4 - }; - } - } - - return asset; - } - } -} diff --git a/Arrowgene.Ddon.Shared/AssetRepository.cs b/Arrowgene.Ddon.Shared/AssetRepository.cs index 2444d1a03..ea2b71bc1 100644 --- a/Arrowgene.Ddon.Shared/AssetRepository.cs +++ b/Arrowgene.Ddon.Shared/AssetRepository.cs @@ -42,7 +42,9 @@ public class AssetRepository public const string JobValueShopKey = "JobValueShop.csv"; public const string StampBonusKey = "StampBonus.csv"; public const string SpecialShopKey = "SpecialShops.json"; - public const string PawnCostReductionKey = "PawnCostReduction.json"; + public const string PawnCostReductionKey = "PawnCostReduction.json"; + public const string PawnCraftSkillCostRateKey = "PawnCraftSkillCostRate.csv"; + public const string PawnCraftSkillSpeedRateKey = "PawnCraftSkillSpeedRate.csv"; public const string BitterblackMazeKey = "BitterblackMaze.json"; public const string QuestDropItemsKey = "QuestEnemyDrops.json"; public const string RecruitmentBoardCategoryKey = "RecruitmentGroups.json"; @@ -95,7 +97,6 @@ public AssetRepository(string folder) JobValueShopAsset = new List<(JobId, CDataJobValueShopItem)>(); CostExpScalingAsset = new CostExpScalingAsset(); SpecialShopAsset = new SpecialShopAsset(); - PawnCostReductionAsset = new PawnCostReductionAsset(); BitterblackMazeAsset = new BitterblackMazeAsset(); QuestDropItemAsset = new QuestDropItemAsset(); RecruitmentBoardCategoryAsset = new RecruitmentBoardCategoryAsset(); @@ -104,6 +105,8 @@ public AssetRepository(string folder) ClanShopAsset = new Dictionary(); EpitaphRoadAssets = new EpitaphRoadAsset(); EpitaphTrialAssets = new EpitaphTrialAsset(); + PawnCraftSkillCostRateAsset = new(); + PawnCraftSkillSpeedRateAsset = new(); } public List ClientErrorCodes { get; private set; } @@ -130,7 +133,8 @@ public AssetRepository(string folder) public List<(JobId, CDataJobValueShopItem)> JobValueShopAsset { get; private set; } public List StampBonusAsset { get; private set; } public SpecialShopAsset SpecialShopAsset { get; private set; } - public PawnCostReductionAsset PawnCostReductionAsset { get; private set; } + public List PawnCraftSkillCostRateAsset { get; private set; } + public List PawnCraftSkillSpeedRateAsset { get; private set; } public BitterblackMazeAsset BitterblackMazeAsset { get; private set; } public QuestDropItemAsset QuestDropItemAsset { get; private set; } public RecruitmentBoardCategoryAsset RecruitmentBoardCategoryAsset { get; private set; } @@ -165,7 +169,6 @@ public void Initialize() RegisterAsset(value => StampBonusAsset = value, StampBonusKey, new StampBonusCsv()); RegisterAsset(value => CostExpScalingAsset = value, CostExpScalingInfoKey, new CostExpScalingAssetDeserializer()); RegisterAsset(value => SpecialShopAsset = value, SpecialShopKey, new SpecialShopDeserializer()); - RegisterAsset(value => PawnCostReductionAsset = value, PawnCostReductionKey, new PawnCostReductionAssetDeserializer()); RegisterAsset(value => BitterblackMazeAsset = value, BitterblackMazeKey, new BitterblackMazeAssetDeserializer()); RegisterAsset(value => QuestDropItemAsset = value, QuestDropItemsKey, new QuestDropAssetDeserializer()); RegisterAsset(value => RecruitmentBoardCategoryAsset = value, RecruitmentBoardCategoryKey, new RecruitmentBoardCategoryDeserializer()); @@ -173,6 +176,8 @@ public void Initialize() RegisterAsset(value => BonusDungeonAsset = value, BonusDungeonKey, new BonusDungeonAssetDeserializer()); RegisterAsset(value => ClanShopAsset = value.ToDictionary(key => key.LineupId, value => value), ClanShopKey, new ClanShopCsv()); RegisterAsset(value => EpitaphRoadAssets = value, EpitaphRoadKey, new EpitaphRoadAssertDeserializer()); + RegisterAsset(value => PawnCraftSkillCostRateAsset = value, PawnCraftSkillCostRateKey, new PawnCraftSkillCostRateCsv()); + RegisterAsset(value => PawnCraftSkillSpeedRateAsset = value, PawnCraftSkillSpeedRateKey, new PawnCraftSkillSpeedRateCsv()); // This must be set before calling QuestAssertDeserializer and EpitaphTrialAssertDeserializer var commonEnemyDeserializer = new AssetCommonDeserializer(this.NamedParamAsset); diff --git a/Arrowgene.Ddon.Shared/Csv/PawnCraftSkillCostRateCsv.cs b/Arrowgene.Ddon.Shared/Csv/PawnCraftSkillCostRateCsv.cs new file mode 100644 index 000000000..4d890f911 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Csv/PawnCraftSkillCostRateCsv.cs @@ -0,0 +1,29 @@ +using Arrowgene.Ddon.Shared.Model; + +namespace Arrowgene.Ddon.Shared.Csv +{ + public class PawnCraftSkillCostRateCsv : CsvReaderWriter + { + protected override int NumExpectedItems => 5; + + protected override PawnCraftSkillCostRate CreateInstance(string[] properties) + { + if (!uint.TryParse(properties[0], out uint total)) return null; + if (!float.TryParse(properties[1], out float rate1)) return null; + if (!float.TryParse(properties[2], out float rate2)) return null; + if (!float.TryParse(properties[3], out float rate3)) return null; + if (!float.TryParse(properties[4], out float rate4)) return null; + + var obj = new PawnCraftSkillCostRate() + { + Total = total, + CostRate1 = rate1, + CostRate2 = rate2, + CostRate3 = rate3, + CostRate4 = rate4, + }; + + return obj; + } + } +} diff --git a/Arrowgene.Ddon.Shared/Csv/PawnCraftSkillSpeedRateCsv.cs b/Arrowgene.Ddon.Shared/Csv/PawnCraftSkillSpeedRateCsv.cs new file mode 100644 index 000000000..4e81a2155 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Csv/PawnCraftSkillSpeedRateCsv.cs @@ -0,0 +1,25 @@ +using Arrowgene.Ddon.Shared.Model; + +namespace Arrowgene.Ddon.Shared.Csv +{ + internal class PawnCraftSkillSpeedRateCsv : CsvReaderWriter + { + protected override int NumExpectedItems => 5; + + protected override PawnCraftSkillSpeedRate CreateInstance(string[] properties) + { + if (!uint.TryParse(properties[0], out uint level)) return null; + if (!float.TryParse(properties[1], out float rate1)) return null; + if (!float.TryParse(properties[2], out float rate2)) return null; + + var obj = new PawnCraftSkillSpeedRate() + { + Level = level, + SpeedRate1 = rate1, + SpeedRate2 = rate2, + }; + + return obj; + } + } +} diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftSkillAnalyzeReq.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftSkillAnalyzeReq.cs index 136ce48a6..76c529a73 100644 --- a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftSkillAnalyzeReq.cs +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftSkillAnalyzeReq.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; using Arrowgene.Buffers; using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Ddon.Shared.Model; using Arrowgene.Ddon.Shared.Network; +using System.Collections.Generic; namespace Arrowgene.Ddon.Shared.Entity.PacketStructure { @@ -17,12 +16,12 @@ public C2SCraftSkillAnalyzeReq() } public CraftType CraftType { get; set; } - public UInt32 RecipeId { get; set; } - public UInt32 ItemId { get; set; } - public UInt32 PawnId { get; set; } + public uint RecipeId { get; set; } + public uint ItemId { get; set; } + public uint PawnId { get; set; } /// This will never contain Master Craft / Legend Pawn IDs, even though they might have an effect on the analysis. public List AssistPawnIds { get; set; } - public UInt32 CreateCount { get; set; } + public uint CreateCount { get; set; } public class Serializer : PacketEntitySerializer { diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftStartEquipGradeUpReq.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftStartEquipGradeUpReq.cs index a05db85bc..44bc56b5b 100644 --- a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftStartEquipGradeUpReq.cs +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftStartEquipGradeUpReq.cs @@ -15,14 +15,14 @@ public C2SCraftStartEquipGradeUpReq() EquipItemUID = string.Empty; CraftMaterialList = new List(); CraftSupportPawnIDList = new List(); - Unk0 = new List(); + CraftMasterLegendPawnIDList = new List(); } public string EquipItemUID { get; set; } public List CraftMaterialList { get; set; } public uint CraftMainPawnID { get; set; } public List CraftSupportPawnIDList { get; set; } - public List Unk0 { get; set; } // never populates? + public List CraftMasterLegendPawnIDList { get; set; } public class Serializer : PacketEntitySerializer @@ -33,7 +33,7 @@ public override void Write(IBuffer buffer, C2SCraftStartEquipGradeUpReq obj) WriteEntityList(buffer, obj.CraftMaterialList); WriteUInt32(buffer, obj.CraftMainPawnID); WriteEntityList(buffer, obj.CraftSupportPawnIDList); - WriteEntityList(buffer, obj.Unk0); + WriteEntityList(buffer, obj.CraftMasterLegendPawnIDList); } public override C2SCraftStartEquipGradeUpReq Read(IBuffer buffer) @@ -43,7 +43,7 @@ public override C2SCraftStartEquipGradeUpReq Read(IBuffer buffer) obj.CraftMaterialList = ReadEntityList(buffer); obj.CraftMainPawnID = ReadUInt32(buffer); obj.CraftSupportPawnIDList = ReadEntityList(buffer); - obj.Unk0 = ReadEntityList(buffer); + obj.CraftMasterLegendPawnIDList = ReadEntityList(buffer); return obj; } } diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftStartQualityUpReq.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftStartQualityUpReq.cs index c5f990f6d..0a0092d3c 100644 --- a/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftStartQualityUpReq.cs +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/C2SCraftStartQualityUpReq.cs @@ -15,7 +15,7 @@ public C2SCraftStartQualityUpReq() RefineUID = string.Empty; CraftMaterialList = new List(); CraftSupportPawnIDList = new List(); - Unk3 = new List(); + CraftMasterLegendPawnIDList = new List(); } public string ItemUID { get; set; } @@ -24,7 +24,7 @@ public C2SCraftStartQualityUpReq() public List CraftMaterialList { get; set; } public uint CraftMainPawnID { get; set; } public List CraftSupportPawnIDList { get; set; } - public List Unk3 { get; set; } // Never populates? + public List CraftMasterLegendPawnIDList { get; set; } public class Serializer : PacketEntitySerializer { @@ -36,7 +36,7 @@ public override void Write(IBuffer buffer, C2SCraftStartQualityUpReq obj) WriteEntityList(buffer, obj.CraftMaterialList); WriteUInt32(buffer, obj.CraftMainPawnID); WriteEntityList(buffer, obj.CraftSupportPawnIDList); - WriteEntityList(buffer, obj.Unk3); + WriteEntityList(buffer, obj.CraftMasterLegendPawnIDList); } public override C2SCraftStartQualityUpReq Read(IBuffer buffer) @@ -48,10 +48,10 @@ public override C2SCraftStartQualityUpReq Read(IBuffer buffer) obj.CraftMaterialList = ReadEntityList(buffer); obj.CraftMainPawnID = ReadUInt32(buffer); obj.CraftSupportPawnIDList = ReadEntityList(buffer); - obj.Unk3 = ReadEntityList(buffer); + obj.CraftMasterLegendPawnIDList = ReadEntityList(buffer); return obj; } } } -} \ No newline at end of file +} diff --git a/Arrowgene.Ddon.Shared/Entity/Structure/CDataCraftSkillAnalyzeResult.cs b/Arrowgene.Ddon.Shared/Entity/Structure/CDataCraftSkillAnalyzeResult.cs index 97ac15748..6dbba0446 100644 --- a/Arrowgene.Ddon.Shared/Entity/Structure/CDataCraftSkillAnalyzeResult.cs +++ b/Arrowgene.Ddon.Shared/Entity/Structure/CDataCraftSkillAnalyzeResult.cs @@ -1,8 +1,6 @@ -using System; -using System.Collections.Generic; using Arrowgene.Buffers; using Arrowgene.Ddon.Shared.Model; - + namespace Arrowgene.Ddon.Shared.Entity.Structure { public class CDataCraftSkillAnalyzeResult @@ -13,8 +11,8 @@ public CDataCraftSkillAnalyzeResult() public CraftSkillType SkillType { get; set; } public byte Rate { get; set; } - public UInt32 Value0 { get; set; } - public UInt32 Value1 { get; set; } + public uint Value0 { get; set; } + public uint Value1 { get; set; } public class Serializer : EntitySerializer { diff --git a/Arrowgene.Ddon.Shared/Files/Assets/PawnCostReduction.json b/Arrowgene.Ddon.Shared/Files/Assets/PawnCostReduction.json deleted file mode 100644 index 263dae5ab..000000000 --- a/Arrowgene.Ddon.Shared/Files/Assets/PawnCostReduction.json +++ /dev/null @@ -1,1276 +0,0 @@ -[ - { - "Total": 0, - "CostRate1": 100.0, - "CostRate2": 95.0, - "CostRate3": 85.0, - "CostRate4": 84.5 - }, - { - "Total": 1, - "CostRate1": 96.0, - "CostRate2": 94.5, - "CostRate3": 84.7, - "CostRate4": 84.0 - }, - { - "Total": 2, - "CostRate1": 95.0, - "CostRate2": 94.0, - "CostRate3": 84.4, - "CostRate4": 83.7 - }, - { - "Total": 3, - "CostRate1": 94.0, - "CostRate2": 93.5, - "CostRate3": 84.1, - "CostRate4": 83.4 - }, - { - "Total": 4, - "CostRate1": 93.2, - "CostRate2": 93.0, - "CostRate3": 83.8, - "CostRate4": 83.1 - }, - { - "Total": 5, - "CostRate1": 92.4, - "CostRate2": 92.0, - "CostRate3": 83.5, - "CostRate4": 82.8 - }, - { - "Total": 6, - "CostRate1": 91.6, - "CostRate2": 91.0, - "CostRate3": 83.2, - "CostRate4": 82.5 - }, - { - "Total": 7, - "CostRate1": 90.8, - "CostRate2": 90.0, - "CostRate3": 82.9, - "CostRate4": 82.2 - }, - { - "Total": 8, - "CostRate1": 90.0, - "CostRate2": 89.0, - "CostRate3": 82.6, - "CostRate4": 81.9 - }, - { - "Total": 9, - "CostRate1": 89.2, - "CostRate2": 88.0, - "CostRate3": 82.3, - "CostRate4": 81.6 - }, - { - "Total": 10, - "CostRate1": 88.4, - "CostRate2": 87.0, - "CostRate3": 82.0, - "CostRate4": 81.3 - }, - { - "Total": 11, - "CostRate1": 87.6, - "CostRate2": 86.0, - "CostRate3": 81.7, - "CostRate4": 81.0 - }, - { - "Total": 12, - "CostRate1": 86.8, - "CostRate2": 85.0, - "CostRate3": 81.4, - "CostRate4": 80.7 - }, - { - "Total": 13, - "CostRate1": 86.0, - "CostRate2": 84.0, - "CostRate3": 81.1, - "CostRate4": 80.4 - }, - { - "Total": 14, - "CostRate1": 85.0, - "CostRate2": 83.0, - "CostRate3": 80.8, - "CostRate4": 80.1 - }, - { - "Total": 15, - "CostRate1": 84.0, - "CostRate2": 82.0, - "CostRate3": 80.0, - "CostRate4": 79.0 - }, - { - "Total": 16, - "CostRate1": 83.0, - "CostRate2": 81.0, - "CostRate3": 79.0, - "CostRate4": 78.0 - }, - { - "Total": 17, - "CostRate1": 82.0, - "CostRate2": 80.0, - "CostRate3": 78.0, - "CostRate4": 77.0 - }, - { - "Total": 18, - "CostRate1": 81.0, - "CostRate2": 79.0, - "CostRate3": 77.0, - "CostRate4": 76.0 - }, - { - "Total": 19, - "CostRate1": 80.0, - "CostRate2": 78.0, - "CostRate3": 76.0, - "CostRate4": 75.0 - }, - { - "Total": 20, - "CostRate1": 79.0, - "CostRate2": 77.0, - "CostRate3": 75.0, - "CostRate4": 74.0 - }, - { - "Total": 21, - "CostRate1": 78.0, - "CostRate2": 76.0, - "CostRate3": 74.0, - "CostRate4": 73.0 - }, - { - "Total": 22, - "CostRate1": 77.0, - "CostRate2": 75.0, - "CostRate3": 73.0, - "CostRate4": 72.0 - }, - { - "Total": 23, - "CostRate1": 76.0, - "CostRate2": 74.0, - "CostRate3": 72.0, - "CostRate4": 71.0 - }, - { - "Total": 24, - "CostRate1": 75.0, - "CostRate2": 73.0, - "CostRate3": 71.0, - "CostRate4": 70.0 - }, - { - "Total": 25, - "CostRate1": 74.0, - "CostRate2": 72.0, - "CostRate3": 70.0, - "CostRate4": 69.0 - }, - { - "Total": 26, - "CostRate1": 73.0, - "CostRate2": 71.0, - "CostRate3": 69.0, - "CostRate4": 68.0 - }, - { - "Total": 27, - "CostRate1": 72.0, - "CostRate2": 70.0, - "CostRate3": 68.0, - "CostRate4": 67.0 - }, - { - "Total": 28, - "CostRate1": 71.0, - "CostRate2": 69.0, - "CostRate3": 67.0, - "CostRate4": 66.0 - }, - { - "Total": 29, - "CostRate1": 70.0, - "CostRate2": 68.0, - "CostRate3": 66.0, - "CostRate4": 65.0 - }, - { - "Total": 30, - "CostRate1": 69.5, - "CostRate2": 67.0, - "CostRate3": 65.0, - "CostRate4": 64.0 - }, - { - "Total": 31, - "CostRate1": 69.0, - "CostRate2": 66.5, - "CostRate3": 65.5, - "CostRate4": 63.5 - }, - { - "Total": 32, - "CostRate1": 68.5, - "CostRate2": 66.0, - "CostRate3": 65.0, - "CostRate4": 63.0 - }, - { - "Total": 33, - "CostRate1": 68.0, - "CostRate2": 65.5, - "CostRate3": 64.5, - "CostRate4": 62.5 - }, - { - "Total": 34, - "CostRate1": 67.5, - "CostRate2": 65.0, - "CostRate3": 64.0, - "CostRate4": 62.0 - }, - { - "Total": 35, - "CostRate1": 67.0, - "CostRate2": 64.5, - "CostRate3": 63.5, - "CostRate4": 61.5 - }, - { - "Total": 36, - "CostRate1": 66.5, - "CostRate2": 64.0, - "CostRate3": 63.0, - "CostRate4": 61.0 - }, - { - "Total": 37, - "CostRate1": 66.0, - "CostRate2": 63.5, - "CostRate3": 62.5, - "CostRate4": 60.5 - }, - { - "Total": 38, - "CostRate1": 65.5, - "CostRate2": 63.0, - "CostRate3": 62.0, - "CostRate4": 60.0 - }, - { - "Total": 39, - "CostRate1": 65.0, - "CostRate2": 62.5, - "CostRate3": 61.5, - "CostRate4": 59.5 - }, - { - "Total": 40, - "CostRate1": 64.5, - "CostRate2": 62.0, - "CostRate3": 61.0, - "CostRate4": 59.0 - }, - { - "Total": 41, - "CostRate1": 64.0, - "CostRate2": 61.5, - "CostRate3": 60.5, - "CostRate4": 58.5 - }, - { - "Total": 42, - "CostRate1": 63.5, - "CostRate2": 61.0, - "CostRate3": 60.0, - "CostRate4": 58.0 - }, - { - "Total": 43, - "CostRate1": 63.0, - "CostRate2": 60.5, - "CostRate3": 59.5, - "CostRate4": 57.5 - }, - { - "Total": 44, - "CostRate1": 62.5, - "CostRate2": 60.0, - "CostRate3": 59.0, - "CostRate4": 57.0 - }, - { - "Total": 45, - "CostRate1": 62.0, - "CostRate2": 59.5, - "CostRate3": 58.5, - "CostRate4": 56.5 - }, - { - "Total": 46, - "CostRate1": 61.5, - "CostRate2": 59.0, - "CostRate3": 58.0, - "CostRate4": 56.0 - }, - { - "Total": 47, - "CostRate1": 61.0, - "CostRate2": 58.5, - "CostRate3": 57.5, - "CostRate4": 55.5 - }, - { - "Total": 48, - "CostRate1": 60.5, - "CostRate2": 58.0, - "CostRate3": 57.0, - "CostRate4": 55.0 - }, - { - "Total": 49, - "CostRate1": 60.0, - "CostRate2": 57.5, - "CostRate3": 56.5, - "CostRate4": 54.5 - }, - { - "Total": 50, - "CostRate1": 59.5, - "CostRate2": 57.0, - "CostRate3": 56.0, - "CostRate4": 54.0 - }, - { - "Total": 51, - "CostRate1": 59.0, - "CostRate2": 56.5, - "CostRate3": 55.5, - "CostRate4": 53.5 - }, - { - "Total": 52, - "CostRate1": 58.5, - "CostRate2": 56.0, - "CostRate3": 55.0, - "CostRate4": 53.0 - }, - { - "Total": 53, - "CostRate1": 58.0, - "CostRate2": 55.5, - "CostRate3": 54.5, - "CostRate4": 52.5 - }, - { - "Total": 54, - "CostRate1": 57.5, - "CostRate2": 55.0, - "CostRate3": 54.0, - "CostRate4": 52.0 - }, - { - "Total": 55, - "CostRate1": 57.0, - "CostRate2": 54.5, - "CostRate3": 53.5, - "CostRate4": 51.5 - }, - { - "Total": 56, - "CostRate1": 56.5, - "CostRate2": 54.0, - "CostRate3": 53.0, - "CostRate4": 51.0 - }, - { - "Total": 57, - "CostRate1": 56.0, - "CostRate2": 53.5, - "CostRate3": 52.5, - "CostRate4": 50.5 - }, - { - "Total": 58, - "CostRate1": 55.5, - "CostRate2": 53.0, - "CostRate3": 52.0, - "CostRate4": 50.0 - }, - { - "Total": 59, - "CostRate1": 55.0, - "CostRate2": 52.5, - "CostRate3": 51.5, - "CostRate4": 49.5 - }, - { - "Total": 60, - "CostRate1": 54.5, - "CostRate2": 52.0, - "CostRate3": 51.0, - "CostRate4": 49.0 - }, - { - "Total": 61, - "CostRate1": 54.0, - "CostRate2": 51.5, - "CostRate3": 50.5, - "CostRate4": 48.5 - }, - { - "Total": 62, - "CostRate1": 53.5, - "CostRate2": 51.0, - "CostRate3": 50.0, - "CostRate4": 48.0 - }, - { - "Total": 63, - "CostRate1": 53.0, - "CostRate2": 50.5, - "CostRate3": 49.5, - "CostRate4": 47.5 - }, - { - "Total": 64, - "CostRate1": 52.5, - "CostRate2": 50.0, - "CostRate3": 49.0, - "CostRate4": 47.0 - }, - { - "Total": 65, - "CostRate1": 52.0, - "CostRate2": 49.5, - "CostRate3": 48.5, - "CostRate4": 46.5 - }, - { - "Total": 66, - "CostRate1": 51.5, - "CostRate2": 49.0, - "CostRate3": 48.0, - "CostRate4": 46.0 - }, - { - "Total": 67, - "CostRate1": 51.0, - "CostRate2": 48.5, - "CostRate3": 47.5, - "CostRate4": 45.5 - }, - { - "Total": 68, - "CostRate1": 50.5, - "CostRate2": 48.0, - "CostRate3": 47.0, - "CostRate4": 45.0 - }, - { - "Total": 69, - "CostRate1": 50.0, - "CostRate2": 47.5, - "CostRate3": 46.5, - "CostRate4": 44.5 - }, - { - "Total": 70, - "CostRate1": 49.5, - "CostRate2": 47.0, - "CostRate3": 46.0, - "CostRate4": 44.0 - }, - { - "Total": 71, - "CostRate1": 49.0, - "CostRate2": 46.5, - "CostRate3": 45.5, - "CostRate4": 43.5 - }, - { - "Total": 72, - "CostRate1": 48.5, - "CostRate2": 46.0, - "CostRate3": 45.0, - "CostRate4": 43.0 - }, - { - "Total": 73, - "CostRate1": 48.0, - "CostRate2": 45.5, - "CostRate3": 44.5, - "CostRate4": 42.5 - }, - { - "Total": 74, - "CostRate1": 47.5, - "CostRate2": 45.0, - "CostRate3": 44.0, - "CostRate4": 42.0 - }, - { - "Total": 75, - "CostRate1": 47.0, - "CostRate2": 44.5, - "CostRate3": 43.5, - "CostRate4": 41.5 - }, - { - "Total": 76, - "CostRate1": 46.5, - "CostRate2": 44.0, - "CostRate3": 43.0, - "CostRate4": 41.0 - }, - { - "Total": 77, - "CostRate1": 46.0, - "CostRate2": 43.5, - "CostRate3": 42.5, - "CostRate4": 40.5 - }, - { - "Total": 78, - "CostRate1": 45.5, - "CostRate2": 43.0, - "CostRate3": 42.0, - "CostRate4": 40.0 - }, - { - "Total": 79, - "CostRate1": 45.0, - "CostRate2": 42.5, - "CostRate3": 41.5, - "CostRate4": 39.5 - }, - { - "Total": 80, - "CostRate1": 44.5, - "CostRate2": 42.0, - "CostRate3": 41.0, - "CostRate4": 39.0 - }, - { - "Total": 81, - "CostRate1": 44.0, - "CostRate2": 41.5, - "CostRate3": 40.5, - "CostRate4": 38.5 - }, - { - "Total": 82, - "CostRate1": 43.5, - "CostRate2": 41.0, - "CostRate3": 40.0, - "CostRate4": 38.0 - }, - { - "Total": 83, - "CostRate1": 43.0, - "CostRate2": 40.5, - "CostRate3": 39.5, - "CostRate4": 37.5 - }, - { - "Total": 84, - "CostRate1": 42.5, - "CostRate2": 40.0, - "CostRate3": 39.0, - "CostRate4": 37.0 - }, - { - "Total": 85, - "CostRate1": 42.0, - "CostRate2": 39.0, - "CostRate3": 38.5, - "CostRate4": 36.5 - }, - { - "Total": 86, - "CostRate1": 41.0, - "CostRate2": 38.0, - "CostRate3": 37.5, - "CostRate4": 35.5 - }, - { - "Total": 87, - "CostRate1": 40.0, - "CostRate2": 37.0, - "CostRate3": 36.5, - "CostRate4": 34.5 - }, - { - "Total": 88, - "CostRate1": 39.0, - "CostRate2": 36.0, - "CostRate3": 35.5, - "CostRate4": 33.5 - }, - { - "Total": 89, - "CostRate1": 38.0, - "CostRate2": 35.0, - "CostRate3": 34.5, - "CostRate4": 32.5 - }, - { - "Total": 90, - "CostRate1": 37.0, - "CostRate2": 34.0, - "CostRate3": 33.5, - "CostRate4": 31.5 - }, - { - "Total": 91, - "CostRate1": 36.0, - "CostRate2": 33.0, - "CostRate3": 32.5, - "CostRate4": 30.5 - }, - { - "Total": 92, - "CostRate1": 35.0, - "CostRate2": 32.0, - "CostRate3": 31.5, - "CostRate4": 29.5 - }, - { - "Total": 93, - "CostRate1": 34.0, - "CostRate2": 31.0, - "CostRate3": 30.5, - "CostRate4": 28.5 - }, - { - "Total": 94, - "CostRate1": 33.0, - "CostRate2": 30.0, - "CostRate3": 29.5, - "CostRate4": 27.5 - }, - { - "Total": 95, - "CostRate1": 32.0, - "CostRate2": 29.0, - "CostRate3": 28.5, - "CostRate4": 26.5 - }, - { - "Total": 96, - "CostRate1": 31.0, - "CostRate2": 28.0, - "CostRate3": 27.5, - "CostRate4": 25.5 - }, - { - "Total": 97, - "CostRate1": 30.0, - "CostRate2": 27.0, - "CostRate3": 26.5, - "CostRate4": 24.5 - }, - { - "Total": 98, - "CostRate1": 29.0, - "CostRate2": 26.0, - "CostRate3": 25.5, - "CostRate4": 23.5 - }, - { - "Total": 99, - "CostRate1": 28.0, - "CostRate2": 25.0, - "CostRate3": 24.5, - "CostRate4": 22.5 - }, - { - "Total": 100, - "CostRate1": 27.85, - "CostRate2": 24.85, - "CostRate3": 24.35, - "CostRate4": 22.35 - }, - { - "Total": 101, - "CostRate1": 27.7, - "CostRate2": 24.7, - "CostRate3": 24.2, - "CostRate4": 22.2 - }, - { - "Total": 102, - "CostRate1": 27.55, - "CostRate2": 24.55, - "CostRate3": 24.05, - "CostRate4": 22.05 - }, - { - "Total": 103, - "CostRate1": 27.4, - "CostRate2": 24.4, - "CostRate3": 23.9, - "CostRate4": 21.9 - }, - { - "Total": 104, - "CostRate1": 27.25, - "CostRate2": 24.25, - "CostRate3": 23.75, - "CostRate4": 21.75 - }, - { - "Total": 105, - "CostRate1": 27.1, - "CostRate2": 24.1, - "CostRate3": 23.6, - "CostRate4": 21.6 - }, - { - "Total": 106, - "CostRate1": 26.95, - "CostRate2": 23.95, - "CostRate3": 23.45, - "CostRate4": 21.45 - }, - { - "Total": 107, - "CostRate1": 26.8, - "CostRate2": 23.8, - "CostRate3": 23.3, - "CostRate4": 21.3 - }, - { - "Total": 108, - "CostRate1": 26.65, - "CostRate2": 23.65, - "CostRate3": 23.15, - "CostRate4": 21.15 - }, - { - "Total": 109, - "CostRate1": 26.5, - "CostRate2": 23.5, - "CostRate3": 23.0, - "CostRate4": 21.0 - }, - { - "Total": 110, - "CostRate1": 26.35, - "CostRate2": 23.35, - "CostRate3": 22.85, - "CostRate4": 20.85 - }, - { - "Total": 111, - "CostRate1": 26.2, - "CostRate2": 23.2, - "CostRate3": 22.7, - "CostRate4": 20.7 - }, - { - "Total": 112, - "CostRate1": 26.05, - "CostRate2": 23.05, - "CostRate3": 22.55, - "CostRate4": 20.55 - }, - { - "Total": 113, - "CostRate1": 25.9, - "CostRate2": 22.9, - "CostRate3": 22.4, - "CostRate4": 20.4 - }, - { - "Total": 114, - "CostRate1": 25.75, - "CostRate2": 22.75, - "CostRate3": 22.25, - "CostRate4": 20.25 - }, - { - "Total": 115, - "CostRate1": 25.6, - "CostRate2": 22.6, - "CostRate3": 22.1, - "CostRate4": 20.1 - }, - { - "Total": 116, - "CostRate1": 25.45, - "CostRate2": 22.45, - "CostRate3": 21.95, - "CostRate4": 19.95 - }, - { - "Total": 117, - "CostRate1": 25.3, - "CostRate2": 22.3, - "CostRate3": 21.8, - "CostRate4": 19.8 - }, - { - "Total": 118, - "CostRate1": 25.15, - "CostRate2": 22.15, - "CostRate3": 21.65, - "CostRate4": 19.65 - }, - { - "Total": 119, - "CostRate1": 25.0, - "CostRate2": 22.0, - "CostRate3": 21.5, - "CostRate4": 19.5 - }, - { - "Total": 120, - "CostRate1": 24.5, - "CostRate2": 21.85, - "CostRate3": 21.0, - "CostRate4": 19.2 - }, - { - "Total": 121, - "CostRate1": 24.2, - "CostRate2": 21.7, - "CostRate3": 20.7, - "CostRate4": 18.9 - }, - { - "Total": 122, - "CostRate1": 23.9, - "CostRate2": 21.4, - "CostRate3": 20.4, - "CostRate4": 18.6 - }, - { - "Total": 123, - "CostRate1": 23.6, - "CostRate2": 21.1, - "CostRate3": 20.1, - "CostRate4": 18.3 - }, - { - "Total": 124, - "CostRate1": 23.3, - "CostRate2": 20.8, - "CostRate3": 19.8, - "CostRate4": 18.0 - }, - { - "Total": 125, - "CostRate1": 23.0, - "CostRate2": 20.5, - "CostRate3": 19.5, - "CostRate4": 17.7 - }, - { - "Total": 126, - "CostRate1": 22.7, - "CostRate2": 20.2, - "CostRate3": 19.2, - "CostRate4": 17.4 - }, - { - "Total": 127, - "CostRate1": 22.4, - "CostRate2": 19.9, - "CostRate3": 18.9, - "CostRate4": 17.1 - }, - { - "Total": 128, - "CostRate1": 22.1, - "CostRate2": 19.6, - "CostRate3": 18.6, - "CostRate4": 16.8 - }, - { - "Total": 129, - "CostRate1": 21.8, - "CostRate2": 19.3, - "CostRate3": 18.3, - "CostRate4": 16.5 - }, - { - "Total": 130, - "CostRate1": 21.5, - "CostRate2": 19.0, - "CostRate3": 18.0, - "CostRate4": 16.2 - }, - { - "Total": 131, - "CostRate1": 21.2, - "CostRate2": 18.7, - "CostRate3": 17.7, - "CostRate4": 16.0 - }, - { - "Total": 132, - "CostRate1": 20.9, - "CostRate2": 18.4, - "CostRate3": 17.4, - "CostRate4": 15.8 - }, - { - "Total": 133, - "CostRate1": 20.6, - "CostRate2": 18.1, - "CostRate3": 17.1, - "CostRate4": 15.6 - }, - { - "Total": 134, - "CostRate1": 20.3, - "CostRate2": 17.8, - "CostRate3": 16.8, - "CostRate4": 15.4 - }, - { - "Total": 135, - "CostRate1": 20.0, - "CostRate2": 17.5, - "CostRate3": 16.5, - "CostRate4": 15.2 - }, - { - "Total": 136, - "CostRate1": 19.7, - "CostRate2": 17.2, - "CostRate3": 16.2, - "CostRate4": 15.0 - }, - { - "Total": 137, - "CostRate1": 19.4, - "CostRate2": 16.9, - "CostRate3": 15.9, - "CostRate4": 14.8 - }, - { - "Total": 138, - "CostRate1": 19.1, - "CostRate2": 16.6, - "CostRate3": 15.6, - "CostRate4": 14.6 - }, - { - "Total": 139, - "CostRate1": 18.8, - "CostRate2": 16.3, - "CostRate3": 15.3, - "CostRate4": 14.4 - }, - { - "Total": 140, - "CostRate1": 18.5, - "CostRate2": 16.0, - "CostRate3": 15.0, - "CostRate4": 14.2 - }, - { - "Total": 141, - "CostRate1": 18.2, - "CostRate2": 15.7, - "CostRate3": 14.7, - "CostRate4": 14.0 - }, - { - "Total": 142, - "CostRate1": 17.9, - "CostRate2": 15.4, - "CostRate3": 14.4, - "CostRate4": 13.8 - }, - { - "Total": 143, - "CostRate1": 17.6, - "CostRate2": 15.1, - "CostRate3": 14.1, - "CostRate4": 13.6 - }, - { - "Total": 144, - "CostRate1": 17.3, - "CostRate2": 14.8, - "CostRate3": 13.8, - "CostRate4": 13.4 - }, - { - "Total": 145, - "CostRate1": 17.0, - "CostRate2": 14.5, - "CostRate3": 13.5, - "CostRate4": 13.2 - }, - { - "Total": 146, - "CostRate1": 16.7, - "CostRate2": 14.2, - "CostRate3": 13.2, - "CostRate4": 13.0 - }, - { - "Total": 147, - "CostRate1": 16.4, - "CostRate2": 13.9, - "CostRate3": 12.9, - "CostRate4": 12.8 - }, - { - "Total": 148, - "CostRate1": 16.1, - "CostRate2": 13.6, - "CostRate3": 12.6, - "CostRate4": 12.5 - }, - { - "Total": 149, - "CostRate1": 15.8, - "CostRate2": 13.3, - "CostRate3": 12.3, - "CostRate4": 12.2 - }, - { - "Total": 150, - "CostRate1": 15.5, - "CostRate2": 13.0, - "CostRate3": 12.0, - "CostRate4": 11.9 - }, - { - "Total": 151, - "CostRate1": 15.2, - "CostRate2": 12.7, - "CostRate3": 11.7, - "CostRate4": 11.6 - }, - { - "Total": 152, - "CostRate1": 14.9, - "CostRate2": 12.4, - "CostRate3": 11.4, - "CostRate4": 11.3 - }, - { - "Total": 153, - "CostRate1": 14.6, - "CostRate2": 12.1, - "CostRate3": 11.1, - "CostRate4": 11.0 - }, - { - "Total": 154, - "CostRate1": 14.3, - "CostRate2": 11.8, - "CostRate3": 10.8, - "CostRate4": 10.7 - }, - { - "Total": 155, - "CostRate1": 14.0, - "CostRate2": 11.5, - "CostRate3": 10.5, - "CostRate4": 10.4 - }, - { - "Total": 156, - "CostRate1": 13.7, - "CostRate2": 11.2, - "CostRate3": 10.2, - "CostRate4": 10.1 - }, - { - "Total": 157, - "CostRate1": 13.4, - "CostRate2": 10.9, - "CostRate3": 9.9, - "CostRate4": 9.8 - }, - { - "Total": 158, - "CostRate1": 13.1, - "CostRate2": 10.6, - "CostRate3": 9.6, - "CostRate4": 9.5 - }, - { - "Total": 159, - "CostRate1": 12.8, - "CostRate2": 10.3, - "CostRate3": 9.3, - "CostRate4": 9.2 - }, - { - "Total": 160, - "CostRate1": 12.5, - "CostRate2": 10.0, - "CostRate3": 9.0, - "CostRate4": 8.9 - }, - { - "Total": 161, - "CostRate1": 12.2, - "CostRate2": 9.7, - "CostRate3": 8.7, - "CostRate4": 8.6 - }, - { - "Total": 162, - "CostRate1": 11.9, - "CostRate2": 9.4, - "CostRate3": 8.4, - "CostRate4": 8.3 - }, - { - "Total": 163, - "CostRate1": 11.6, - "CostRate2": 9.1, - "CostRate3": 8.1, - "CostRate4": 8.0 - }, - { - "Total": 164, - "CostRate1": 11.3, - "CostRate2": 8.8, - "CostRate3": 7.8, - "CostRate4": 7.7 - }, - { - "Total": 165, - "CostRate1": 11.0, - "CostRate2": 8.5, - "CostRate3": 7.5, - "CostRate4": 7.4 - }, - { - "Total": 166, - "CostRate1": 10.7, - "CostRate2": 8.2, - "CostRate3": 7.2, - "CostRate4": 7.1 - }, - { - "Total": 167, - "CostRate1": 10.4, - "CostRate2": 7.9, - "CostRate3": 6.9, - "CostRate4": 6.8 - }, - { - "Total": 168, - "CostRate1": 10.1, - "CostRate2": 7.6, - "CostRate3": 6.6, - "CostRate4": 6.5 - }, - { - "Total": 169, - "CostRate1": 9.8, - "CostRate2": 7.3, - "CostRate3": 6.3, - "CostRate4": 6.2 - }, - { - "Total": 170, - "CostRate1": 9.5, - "CostRate2": 7.0, - "CostRate3": 6.0, - "CostRate4": 5.9 - }, - { - "Total": 171, - "CostRate1": 9.2, - "CostRate2": 6.7, - "CostRate3": 5.7, - "CostRate4": 5.6 - }, - { - "Total": 172, - "CostRate1": 8.9, - "CostRate2": 6.4, - "CostRate3": 5.4, - "CostRate4": 5.3 - }, - { - "Total": 173, - "CostRate1": 8.6, - "CostRate2": 6.1, - "CostRate3": 5.1, - "CostRate4": 5.0 - }, - { - "Total": 174, - "CostRate1": 8.3, - "CostRate2": 5.8, - "CostRate3": 4.8, - "CostRate4": 4.7 - }, - { - "Total": 175, - "CostRate1": 8.0, - "CostRate2": 5.5, - "CostRate3": 4.5, - "CostRate4": 4.4 - }, - { - "Total": 176, - "CostRate1": 7.7, - "CostRate2": 5.2, - "CostRate3": 4.2, - "CostRate4": 4.1 - }, - { - "Total": 177, - "CostRate1": 7.4, - "CostRate2": 5.0, - "CostRate3": 3.9, - "CostRate4": 3.8 - }, - { - "Total": 178, - "CostRate1": 7.1, - "CostRate2": 4.8, - "CostRate3": 3.6, - "CostRate4": 3.5 - }, - { - "Total": 179, - "CostRate1": 6.8, - "CostRate2": 4.6, - "CostRate3": 3.3, - "CostRate4": 3.2 - }, - { - "Total": 180, - "CostRate1": 6.5, - "CostRate2": 4.4, - "CostRate3": 3.0, - "CostRate4": 2.9 - }, - { - "Total": 181, - "CostRate1": 6.2, - "CostRate2": 4.2, - "CostRate3": 2.7, - "CostRate4": 2.6 - } -] \ No newline at end of file diff --git a/Arrowgene.Ddon.Shared/Files/Assets/PawnCraftSkillCostRate.csv b/Arrowgene.Ddon.Shared/Files/Assets/PawnCraftSkillCostRate.csv new file mode 100644 index 000000000..04355ebd5 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Files/Assets/PawnCraftSkillCostRate.csv @@ -0,0 +1,183 @@ +#Total,CostRate1,CostRate2,CostRate3,CostRate4,,,,, +0,1.0000,0.9500,0.8500,0.8450,,,,, +1,0.9600,0.9450,0.8470,0.8400,,,,, +2,0.9500,0.9400,0.8440,0.8370,,,,, +3,0.9400,0.9350,0.8410,0.8340,,,,, +4,0.9320,0.9300,0.8380,0.8310,,,,, +5,0.9240,0.9200,0.8350,0.8280,,,,, +6,0.9160,0.9100,0.8320,0.8250,,,,, +7,0.9080,0.9000,0.8290,0.8220,,,,, +8,0.9000,0.8900,0.8260,0.8190,,,,, +9,0.8920,0.8800,0.8230,0.8160,,,,, +10,0.8840,0.8700,0.8200,0.8130,,,,, +11,0.8760,0.8600,0.8170,0.8100,,,,, +12,0.8680,0.8500,0.8140,0.8070,,,,, +13,0.8600,0.8400,0.8110,0.8040,,,,, +14,0.8500,0.8300,0.8080,0.8010,,,,, +15,0.8400,0.8200,0.8000,0.7900,,,,, +16,0.8300,0.8100,0.7900,0.7800,,,,, +17,0.8200,0.8000,0.7800,0.7700,,,,, +18,0.8100,0.7900,0.7700,0.7600,,,,, +19,0.8000,0.7800,0.7600,0.7500,,,,, +20,0.7900,0.7700,0.7500,0.7400,,,,, +21,0.7800,0.7600,0.7400,0.7300,,,,, +22,0.7700,0.7500,0.7300,0.7200,,,,, +23,0.7600,0.7400,0.7200,0.7100,,,,, +24,0.7500,0.7300,0.7100,0.7000,,,,, +25,0.7400,0.7200,0.7000,0.6900,,,,, +26,0.7300,0.7100,0.6900,0.6800,,,,, +27,0.7200,0.7000,0.6800,0.6700,,,,, +28,0.7100,0.6900,0.6700,0.6600,,,,, +29,0.7000,0.6800,0.6600,0.6500,,,,, +30,0.6950,0.6700,0.6500,0.6400,,,,, +31,0.6900,0.6650,0.6550,0.6350,,,,, +32,0.6850,0.6600,0.6500,0.6300,,,,, +33,0.6800,0.6550,0.6450,0.6250,,,,, +34,0.6750,0.6500,0.6400,0.6200,,,,, +35,0.6700,0.6450,0.6350,0.6150,,,,, +36,0.6650,0.6400,0.6300,0.6100,,,,, +37,0.6600,0.6350,0.6250,0.6050,,,,, +38,0.6550,0.6300,0.6200,0.6000,,,,, +39,0.6500,0.6250,0.6150,0.5950,,,,, +40,0.6450,0.6200,0.6100,0.5900,,,,, +41,0.6400,0.6150,0.6050,0.5850,,,,, +42,0.6350,0.6100,0.6000,0.5800,,,,, +43,0.6300,0.6050,0.5950,0.5750,,,,, +44,0.6250,0.6000,0.5900,0.5700,,,,, +45,0.6200,0.5950,0.5850,0.5650,,,,, +46,0.6150,0.5900,0.5800,0.5600,,,,, +47,0.6100,0.5850,0.5750,0.5550,,,,, +48,0.6050,0.5800,0.5700,0.5500,,,,, +49,0.6000,0.5750,0.5650,0.5450,,,,, +50,0.5950,0.5700,0.5600,0.5400,,,,, +51,0.5900,0.5650,0.5550,0.5350,,,,, +52,0.5850,0.5600,0.5500,0.5300,,,,, +53,0.5800,0.5550,0.5450,0.5250,,,,, +54,0.5750,0.5500,0.5400,0.5200,,,,, +55,0.5700,0.5450,0.5350,0.5150,,,,, +56,0.5650,0.5400,0.5300,0.5100,,,,, +57,0.5600,0.5350,0.5250,0.5050,,,,, +58,0.5550,0.5300,0.5200,0.5000,,,,, +59,0.5500,0.5250,0.5150,0.4950,,,,, +60,0.5450,0.5200,0.5100,0.4900,,,,, +61,0.5400,0.5150,0.5050,0.4850,,,,, +62,0.5350,0.5100,0.5000,0.4800,,,,, +63,0.5300,0.5050,0.4950,0.4750,,,,, +64,0.5250,0.5000,0.4900,0.4700,,,,, +65,0.5200,0.4950,0.4850,0.4650,,,,, +66,0.5150,0.4900,0.4800,0.4600,,,,, +67,0.5100,0.4850,0.4750,0.4550,,,,, +68,0.5050,0.4800,0.4700,0.4500,,,,, +69,0.5000,0.4750,0.4650,0.4450,,,,, +70,0.4950,0.4700,0.4600,0.4400,,,,, +71,0.4900,0.4650,0.4550,0.4350,,,,, +72,0.4850,0.4600,0.4500,0.4300,,,,, +73,0.4800,0.4550,0.4450,0.4250,,,,, +74,0.4750,0.4500,0.4400,0.4200,,,,, +75,0.4700,0.4450,0.4350,0.4150,,,,, +76,0.4650,0.4400,0.4300,0.4100,,,,, +77,0.4600,0.4350,0.4250,0.4050,,,,, +78,0.4550,0.4300,0.4200,0.4000,,,,, +79,0.4500,0.4250,0.4150,0.3950,,,,, +80,0.4450,0.4200,0.4100,0.3900,,,,, +81,0.4400,0.4150,0.4050,0.3850,,,,, +82,0.4350,0.4100,0.4000,0.3800,,,,, +83,0.4300,0.4050,0.3950,0.3750,,,,, +84,0.4250,0.4000,0.3900,0.3700,,,,, +85,0.4200,0.3900,0.3850,0.3650,,,,, +86,0.4100,0.3800,0.3750,0.3550,,,,, +87,0.4000,0.3700,0.3650,0.3450,,,,, +88,0.3900,0.3600,0.3550,0.3350,,,,, +89,0.3800,0.3500,0.3450,0.3250,,,,, +90,0.3700,0.3400,0.3350,0.3150,,,,, +91,0.3600,0.3300,0.3250,0.3050,,,,, +92,0.3500,0.3200,0.3150,0.2950,,,,, +93,0.3400,0.3100,0.3050,0.2850,,,,, +94,0.3300,0.3000,0.2950,0.2750,,,,, +95,0.3200,0.2900,0.2850,0.2650,,,,, +96,0.3100,0.2800,0.2750,0.2550,,,,, +97,0.3000,0.2700,0.2650,0.2450,,,,, +98,0.2900,0.2600,0.2550,0.2350,,,,, +99,0.2800,0.2500,0.2450,0.2250,,,,, +100,0.2785,0.2485,0.2435,0.2235,,,,, +101,0.2770,0.2470,0.2420,0.2220,,,,, +102,0.2755,0.2455,0.2405,0.2205,,,,, +103,0.2740,0.2440,0.2390,0.2190,,,,, +104,0.2725,0.2425,0.2375,0.2175,,,,, +105,0.2710,0.2410,0.2360,0.2160,,,,, +106,0.2695,0.2395,0.2345,0.2145,,,,, +107,0.2680,0.2380,0.2330,0.2130,,,,, +108,0.2665,0.2365,0.2315,0.2115,,,,, +109,0.2650,0.2350,0.2300,0.2100,,,,, +110,0.2635,0.2335,0.2285,0.2085,,,,, +111,0.2620,0.2320,0.2270,0.2070,,,,, +112,0.2605,0.2305,0.2255,0.2055,,,,, +113,0.2590,0.2290,0.2240,0.2040,,,,, +114,0.2575,0.2275,0.2225,0.2025,,,,, +115,0.2560,0.2260,0.2210,0.2010,,,,, +116,0.2545,0.2245,0.2195,0.1995,,,,, +117,0.2530,0.2230,0.2180,0.1980,,,,, +118,0.2515,0.2215,0.2165,0.1965,,,,, +119,0.2500,0.2200,0.2150,0.1950,,,,, +120,0.2450,0.2185,0.2100,0.1920,,,,, +121,0.2420,0.2170,0.2070,0.1890,,,,, +122,0.2390,0.2140,0.2040,0.1860,,,,, +123,0.2360,0.2110,0.2010,0.1830,,,,, +124,0.2330,0.2080,0.1980,0.1800,,,,, +125,0.2300,0.2050,0.1950,0.1770,,,,, +126,0.2270,0.2020,0.1920,0.1740,,,,, +127,0.2240,0.1990,0.1890,0.1710,,,,, +128,0.2210,0.1960,0.1860,0.1680,,,,, +129,0.2180,0.1930,0.1830,0.1650,,,,, +130,0.2150,0.1900,0.1800,0.1620,,,,, +131,0.2120,0.1870,0.1770,0.1600,,,,, +132,0.2090,0.1840,0.1740,0.1580,,,,, +133,0.2060,0.1810,0.1710,0.1560,,,,, +134,0.2030,0.1780,0.1680,0.1540,,,,, +135,0.2000,0.1750,0.1650,0.1520,,,,, +136,0.1970,0.1720,0.1620,0.1500,,,,, +137,0.1940,0.1690,0.1590,0.1480,,,,, +138,0.1910,0.1660,0.1560,0.1460,,,,, +139,0.1880,0.1630,0.1530,0.1440,,,,, +140,0.1850,0.1600,0.1500,0.1420,,,,, +141,0.1820,0.1570,0.1470,0.1400,,,,, +142,0.1790,0.1540,0.1440,0.1380,,,,, +143,0.1760,0.1510,0.1410,0.1360,,,,, +144,0.1730,0.1480,0.1380,0.1340,,,,, +145,0.1700,0.1450,0.1350,0.1320,,,,, +146,0.1670,0.1420,0.1320,0.1300,,,,, +147,0.1640,0.1390,0.1290,0.1280,,,,, +148,0.1610,0.1360,0.1260,0.1250,,,,, +149,0.1580,0.1330,0.1230,0.1220,,,,, +150,0.1550,0.1300,0.1200,0.1190,,,,, +151,0.1520,0.1270,0.1170,0.1160,,,,, +152,0.1490,0.1240,0.1140,0.1130,,,,, +153,0.1460,0.1210,0.1110,0.1100,,,,, +154,0.1430,0.1180,0.1080,0.1070,,,,, +155,0.1400,0.1150,0.1050,0.1040,,,,, +156,0.1370,0.1120,0.1020,0.1010,,,,, +157,0.1340,0.1090,0.0990,0.0980,,,,, +158,0.1310,0.1060,0.0960,0.0950,,,,, +159,0.1280,0.1030,0.0930,0.0920,,,,, +160,0.1250,0.1000,0.0900,0.0890,,,,, +161,0.1220,0.0970,0.0870,0.0860,,,,, +162,0.1190,0.0940,0.0840,0.0830,,,,, +163,0.1160,0.0910,0.0810,0.0800,,,,, +164,0.1130,0.0880,0.0780,0.0770,,,,, +165,0.1100,0.0850,0.0750,0.0740,,,,, +166,0.1070,0.0820,0.0720,0.0710,,,,, +167,0.1040,0.0790,0.0690,0.0680,,,,, +168,0.1010,0.0760,0.0660,0.0650,,,,, +169,0.0980,0.0730,0.0630,0.0620,,,,, +170,0.0950,0.0700,0.0600,0.0590,,,,, +171,0.0920,0.0670,0.0570,0.0560,,,,, +172,0.0890,0.0640,0.0540,0.0530,,,,, +173,0.0860,0.0610,0.0510,0.0500,,,,, +174,0.0830,0.0580,0.0480,0.0470,,,,, +175,0.0800,0.0550,0.0450,0.0440,,,,, +176,0.0770,0.0520,0.0420,0.0410,,,,, +177,0.0740,0.0500,0.0390,0.0380,,,,, +178,0.0710,0.0480,0.0360,0.0350,,,,, +179,0.0680,0.0460,0.0330,0.0320,,,,, +180,0.0650,0.0440,0.0300,0.0290,,,,, +181,0.0620,0.0420,0.0270,0.0260,,,,, diff --git a/Arrowgene.Ddon.Shared/Files/Assets/PawnCraftSkillSpeedRate.csv b/Arrowgene.Ddon.Shared/Files/Assets/PawnCraftSkillSpeedRate.csv new file mode 100644 index 000000000..3816d2e2c --- /dev/null +++ b/Arrowgene.Ddon.Shared/Files/Assets/PawnCraftSkillSpeedRate.csv @@ -0,0 +1,122 @@ +#Level,SpdRate1,SpdRate2,,, +0,1.000,0.995,,, +1,0.992,0.990,,, +2,0.989,0.985,,, +3,0.979,0.980,,, +4,0.969,0.975,,, +5,0.958,0.970,,, +6,0.948,0.965,,, +7,0.938,0.960,,, +8,0.927,0.955,,, +9,0.917,0.950,,, +10,0.907,0.945,,, +11,0.897,0.940,,, +12,0.886,0.935,,, +13,0.876,0.930,,, +14,0.866,0.925,,, +15,0.855,0.920,,, +16,0.845,0.915,,, +17,0.835,0.910,,, +18,0.824,0.905,,, +19,0.814,0.900,,, +20,0.804,0.895,,, +21,0.794,0.890,,, +22,0.783,0.885,,, +23,0.773,0.880,,, +24,0.763,0.875,,, +25,0.752,0.870,,, +26,0.742,0.865,,, +27,0.732,0.860,,, +28,0.721,0.855,,, +29,0.711,0.850,,, +30,0.700,0.839,,, +31,0.696,0.828,,, +32,0.693,0.817,,, +33,0.690,0.806,,, +34,0.686,0.795,,, +35,0.683,0.784,,, +36,0.680,0.773,,, +37,0.676,0.762,,, +38,0.673,0.751,,, +39,0.670,0.740,,, +40,0.667,0.729,,, +41,0.663,0.718,,, +42,0.660,0.707,,, +43,0.657,0.696,,, +44,0.653,0.685,,, +45,0.650,0.674,,, +46,0.647,0.663,,, +47,0.643,0.652,,, +48,0.640,0.641,,, +49,0.637,0.630,,, +50,0.634,0.619,,, +51,0.630,0.608,,, +52,0.627,0.597,,, +53,0.624,0.586,,, +54,0.620,0.575,,, +55,0.617,0.564,,, +56,0.614,0.553,,, +57,0.610,0.542,,, +58,0.607,0.531,,, +59,0.604,0.520,,, +60,0.601,0.509,,, +61,0.597,0.498,,, +62,0.594,0.487,,, +63,0.591,0.476,,, +64,0.587,0.465,,, +65,0.584,0.454,,, +66,0.581,0.443,,, +67,0.577,0.432,,, +68,0.574,0.421,,, +69,0.571,0.410,,, +70,0.568,0.399,,, +71,0.564,0.388,,, +72,0.561,0.377,,, +73,0.558,0.366,,, +74,0.554,0.355,,, +75,0.551,0.344,,, +76,0.548,0.333,,, +77,0.544,0.322,,, +78,0.541,0.311,,, +79,0.538,0.300,,, +80,0.535,0.289,,, +81,0.531,0.278,,, +82,0.528,0.267,,, +83,0.525,0.256,,, +84,0.521,0.245,,, +85,0.518,0.234,,, +86,0.515,0.223,,, +87,0.511,0.212,,, +88,0.508,0.201,,, +89,0.505,0.190,,, +90,0.502,0.179,,, +91,0.498,0.168,,, +92,0.495,0.157,,, +93,0.492,0.146,,, +94,0.488,0.135,,, +95,0.485,0.124,,, +96,0.482,0.113,,, +97,0.478,0.102,,, +98,0.475,0.088,,, +99,0.472,0.087,,, +100,0.469,0.087,,, +101,0.465,0.086,,, +102,0.462,0.086,,, +103,0.459,0.085,,, +104,0.455,0.085,,, +105,0.452,0.084,,, +106,0.449,0.084,,, +107,0.445,0.083,,, +108,0.442,0.083,,, +109,0.439,0.082,,, +110,0.436,0.082,,, +111,0.432,0.081,,, +112,0.429,0.081,,, +113,0.426,0.080,,, +114,0.422,0.080,,, +115,0.419,0.079,,, +116,0.416,0.079,,, +117,0.412,0.078,,, +118,0.409,0.078,,, +119,0.406,0.077,,, +120,0.400,0.040,,, diff --git a/Arrowgene.Ddon.Shared/Model/Craft/CraftPawn.cs b/Arrowgene.Ddon.Shared/Model/Craft/CraftPawn.cs new file mode 100644 index 000000000..a5282584a --- /dev/null +++ b/Arrowgene.Ddon.Shared/Model/Craft/CraftPawn.cs @@ -0,0 +1,72 @@ +using Arrowgene.Ddon.Shared.Entity.Structure; + +namespace Arrowgene.Ddon.Shared.Model.Craft +{ + public class CraftPawn + { + + public uint ProductionSpeed { get; set; } + public uint EquipmentEnhancement { get; set; } + public uint EquipmentQuality { get; set; } + public uint ConsumableQuantity { get; set; } + public uint CostPerformance { get; set; } + + public CraftPosition CraftPosition { get; set; } + + /// + /// How much of their skill contributes based on their pawn type and position in the craft. + /// See IR_COLLECTION_VALUE_LIST from the decompiled client. + /// + public double PositionModifier { get; set; } + + public CraftPawn(uint productionSpeed, uint equipmentEnhancement, uint equipmentQuality, uint consumableQuantity, uint costPerformance, CraftPosition craftPosition) + { + ProductionSpeed = productionSpeed; + EquipmentEnhancement = equipmentEnhancement; + EquipmentQuality = equipmentQuality; + ConsumableQuantity = consumableQuantity; + CostPerformance = costPerformance; + CraftPosition = craftPosition; + switch (craftPosition) + { + case CraftPosition.Leader: + case CraftPosition.Legend: + PositionModifier = 1.0; + break; + case CraftPosition.Assistant: + PositionModifier = 0.33; + break; + } + } + + public CraftPawn(Pawn pawn, CraftPosition position) + { + ProductionSpeed = pawn.CraftData.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.ProductionSpeed).Level; + EquipmentEnhancement = pawn.CraftData.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.EquipmentEnhancement).Level; + EquipmentQuality = pawn.CraftData.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.EquipmentQuality).Level; + ConsumableQuantity = pawn.CraftData.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.ConsumableQuantity).Level; + CostPerformance = pawn.CraftData.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.CostPerformance).Level; + CraftPosition = position; + switch (position) + { + case CraftPosition.Leader: + PositionModifier = 1.0; + break; + case CraftPosition.Assistant: + PositionModifier = 0.33; + break; + } + } + + public CraftPawn(CDataRegisteredLegendPawnInfo legendPawn) + { + ProductionSpeed = legendPawn.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.ProductionSpeed).Level; + EquipmentEnhancement = legendPawn.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.EquipmentEnhancement).Level; + EquipmentQuality = legendPawn.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.EquipmentQuality).Level; + ConsumableQuantity = legendPawn.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.ConsumableQuantity).Level; + CostPerformance = legendPawn.PawnCraftSkillList.Find(skill => skill.Type == CraftSkillType.CostPerformance).Level; + CraftPosition = CraftPosition.Legend; + PositionModifier = 1.0; + } + } +} diff --git a/Arrowgene.Ddon.Shared/Model/Craft/CraftPosition.cs b/Arrowgene.Ddon.Shared/Model/Craft/CraftPosition.cs new file mode 100644 index 000000000..2de20519a --- /dev/null +++ b/Arrowgene.Ddon.Shared/Model/Craft/CraftPosition.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Arrowgene.Ddon.Shared.Model.Craft +{ + public enum CraftPosition + { + Leader, + Assistant, + Legend + } +} diff --git a/Arrowgene.Ddon.Shared/Model/PawnCostReductionInfo.cs b/Arrowgene.Ddon.Shared/Model/PawnCraftSkillCostRate.cs similarity index 63% rename from Arrowgene.Ddon.Shared/Model/PawnCostReductionInfo.cs rename to Arrowgene.Ddon.Shared/Model/PawnCraftSkillCostRate.cs index 66dd4a8f9..ac67ac0fb 100644 --- a/Arrowgene.Ddon.Shared/Model/PawnCostReductionInfo.cs +++ b/Arrowgene.Ddon.Shared/Model/PawnCraftSkillCostRate.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Arrowgene.Ddon.Shared.Model { - public class PawnCostReductionInfo + public class PawnCraftSkillCostRate { public uint Total { get; set; } public float CostRate1 { get; set; } diff --git a/Arrowgene.Ddon.Shared/Model/PawnCraftSkillSpeedRate.cs b/Arrowgene.Ddon.Shared/Model/PawnCraftSkillSpeedRate.cs new file mode 100644 index 000000000..007592a68 --- /dev/null +++ b/Arrowgene.Ddon.Shared/Model/PawnCraftSkillSpeedRate.cs @@ -0,0 +1,9 @@ +namespace Arrowgene.Ddon.Shared.Model +{ + public class PawnCraftSkillSpeedRate + { + public uint Level { get; set; } + public float SpeedRate1 { get; set; } + public float SpeedRate2 { get; set; } + } +} diff --git a/Arrowgene.Ddon.Test/GameServer/Characters/CraftManagerTest.cs b/Arrowgene.Ddon.Test/GameServer/Characters/CraftManagerTest.cs index d6d0db9af..e3971111d 100644 --- a/Arrowgene.Ddon.Test/GameServer/Characters/CraftManagerTest.cs +++ b/Arrowgene.Ddon.Test/GameServer/Characters/CraftManagerTest.cs @@ -1,8 +1,9 @@ -using System.Collections.Generic; using Arrowgene.Ddon.Shared; using Arrowgene.Ddon.Shared.Entity.Structure; using Arrowgene.Ddon.Shared.Model; +using Arrowgene.Ddon.Shared.Model.Craft; using Arrowgene.Ddon.Test.Database; +using System.Collections.Generic; using Xunit; namespace Arrowgene.Ddon.GameServer.Characters; @@ -18,25 +19,20 @@ public CraftManagerTest() _craftManager = new CraftManager(_mockServer); } - [Fact] - public void GetCraftingTimeReductionRate_ShouldReturnCorrectValue() - { - List productionSpeedLevels = new List { 10, 20, 30 }; - _mockServer.Setting.GameLogicSetting.AdditionalProductionSpeedFactor = 1.0; - - double result = _craftManager.GetCraftingTimeReductionRate(productionSpeedLevels); - - Assert.True(result is > 0 and < 100); - } - - [Fact] + /*[Fact] public void CalculateRecipeProductionSpeed_ShouldReturnReducedTime() { - List productionSpeedLevels = new List { 70, 70, 70, 70 }; + List craftPawns = new() + { + new(50, 50, 50, 50, 50, CraftPosition.Leader), + new(50, 50, 50, 50, 50, CraftPosition.Assistant), + new(50, 50, 50, 50, 50, CraftPosition.Assistant), + new(50, 50, 50, 50, 50, CraftPosition.Assistant) + }; const uint recipeTime = 100; _mockServer.Setting.GameLogicSetting.AdditionalProductionSpeedFactor = 1.0; - uint result = _craftManager.CalculateRecipeProductionSpeed(recipeTime, productionSpeedLevels); + uint result = _craftManager.CalculateRecipeProductionSpeed(recipeTime, new(), craftPawns); Assert.True(result < recipeTime*0.6); } @@ -44,21 +40,34 @@ public void CalculateRecipeProductionSpeed_ShouldReturnReducedTime() [Fact] public void CalculateRecipeProductionSpeed_ShouldReturnZeroCraftTime_AdditionalFactorHigh() { - List productionSpeedLevels = new List { 70, 70, 70, 70 }; + List craftPawns = new() + { + new(50, 50, 50, 50, 50, CraftPosition.Leader), + new(50, 50, 50, 50, 50, CraftPosition.Assistant), + new(50, 50, 50, 50, 50, CraftPosition.Assistant), + new(50, 50, 50, 50, 50, CraftPosition.Assistant) + }; + const uint recipeTime = 100; _mockServer.Setting.GameLogicSetting.AdditionalProductionSpeedFactor = 100; - uint result = _craftManager.CalculateRecipeProductionSpeed(recipeTime, productionSpeedLevels); + uint result = _craftManager.CalculateRecipeProductionSpeed(recipeTime, new(), craftPawns); Assert.Equal(0u, result); - } + }*/ [Fact] public void CalculateEquipmentEnhancement_ShouldReturnCorrectEnhancementPoints() { - List enhancementLevels = new List { 45, 1, 1, 1 }; + List craftPawns = new() + { + new(50, 50, 50, 50, 50, CraftPosition.Leader), + new(50, 50, 50, 50, 50, CraftPosition.Assistant), + new(50, 50, 50, 50, 50, CraftPosition.Assistant), + new(50, 50, 50, 50, 50, CraftPosition.Assistant) + }; - CraftCalculationResult result = _craftManager.CalculateEquipmentEnhancement(enhancementLevels, 0); // not sure what this is used for but I updated this function, + CraftCalculationResult result = _craftManager.CalculateEquipmentEnhancement(craftPawns, 0); // not sure what this is used for but I updated this function, // so adding a dummy value for calculatedOdds (greatsuccess stuff) Assert.True(result.CalculatedValue >= 150); }