mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
feat: mapping avatar
This commit is contained in:
@@ -27,6 +27,9 @@ public class AvatarConfigExcel : ExcelResource
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public DamageTypeEnum DamageType { get; set; } = 0;
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public AvatarBaseTypeEnum AvatarBaseType { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return AvatarID;
|
||||
|
||||
34
Common/Data/Excel/AvatarRelicRecommendExcel.cs
Normal file
34
Common/Data/Excel/AvatarRelicRecommendExcel.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("AvatarRelicRecommend.json")]
|
||||
public class AvatarRelicRecommendExcel : ExcelResource
|
||||
{
|
||||
public uint AvatarID { get; set; }
|
||||
public List<uint> Set4IDList { get; set; } = [];
|
||||
public List<uint> Set2IDList { get; set; } = [];
|
||||
public List<uint> ScoreRankList { get; set; } = [];
|
||||
public List<AvatarRelicRecommendMainAffix> PropertyList { get; set; } = [];
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return (int)AvatarID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.AvatarRelicRecommendData.TryAdd(AvatarID, this);
|
||||
}
|
||||
}
|
||||
|
||||
public class AvatarRelicRecommendMainAffix
|
||||
{
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RelicTypeEnum RelicType { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public AvatarPropertyTypeEnum PropertyType { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RelicMainAffixConfig.json")]
|
||||
public class RelicMainAffixConfigExcel : ExcelResource
|
||||
@@ -6,7 +10,8 @@ public class RelicMainAffixConfigExcel : ExcelResource
|
||||
public int GroupID { get; set; }
|
||||
public int AffixID { get; set; }
|
||||
|
||||
public string? Property { get; set; }
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public AvatarPropertyTypeEnum Property { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RelicSubAffixConfig.json")]
|
||||
public class RelicSubAffixConfigExcel : ExcelResource
|
||||
@@ -7,7 +11,10 @@ public class RelicSubAffixConfigExcel : ExcelResource
|
||||
public int AffixID { get; set; }
|
||||
|
||||
public int StepNum { get; set; }
|
||||
public string? Property { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public AvatarPropertyTypeEnum Property { get; set; }
|
||||
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
|
||||
25
Common/Data/Excel/UpgradeAvatarEquipmentExcel.cs
Normal file
25
Common/Data/Excel/UpgradeAvatarEquipmentExcel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("UpgradeAvatarEquipment.json")]
|
||||
public class UpgradeAvatarEquipmentExcel : ExcelResource
|
||||
{
|
||||
[JsonProperty("ELADHEIOONA")] public uint EquipmentId { get; set; }
|
||||
|
||||
[JsonProperty("FJIFJPGEJID")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public AvatarBaseTypeEnum BaseType { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return (int)BaseType;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.UpgradeAvatarEquipmentData.TryAdd(BaseType, this);
|
||||
}
|
||||
}
|
||||
52
Common/Data/Excel/UpgradeAvatarSubRelicExcel.cs
Normal file
52
Common/Data/Excel/UpgradeAvatarSubRelicExcel.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using EggLink.DanhengServer.Enums.Item;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("UpgradeAvatarSubRelic.json")]
|
||||
public class UpgradeAvatarSubRelicExcel : ExcelResource
|
||||
{
|
||||
[JsonProperty("GOBEGPKDLLF")]
|
||||
public uint RelicLevel { get; set; }
|
||||
|
||||
[JsonProperty("COACLFEBBDA")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public UpgradeAvatarSubRelicTypeEnum SubType { get; set; }
|
||||
|
||||
[JsonProperty("JLLLGAGBEMF")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RarityEnum Rarity { get; set; }
|
||||
|
||||
|
||||
[JsonProperty("GEEKCAGBGMN")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RelicTypeEnum Type { get; set; }
|
||||
|
||||
[JsonProperty("PINMGEKOAKM")]
|
||||
public List<UpgradeAvatarSubAffixInfo> SubAffixes { get; set; } = [];
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return (int)SubType;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.UpgradeAvatarSubRelicData.TryAdd(SubType, []);
|
||||
GameData.UpgradeAvatarSubRelicData[SubType].TryAdd(Rarity, []);
|
||||
GameData.UpgradeAvatarSubRelicData[SubType][Rarity].TryAdd(RelicLevel, []);
|
||||
GameData.UpgradeAvatarSubRelicData[SubType][Rarity][RelicLevel].TryAdd(Type, this);
|
||||
}
|
||||
}
|
||||
|
||||
public class UpgradeAvatarSubAffixInfo
|
||||
{
|
||||
[JsonProperty("KHADHNNCFLH")]
|
||||
public uint AffixCount { get; set; }
|
||||
|
||||
[JsonProperty("LKOEFDPJGKD")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public AvatarPropertyTypeEnum AffixProperty { get; set; }
|
||||
}
|
||||
31
Common/Data/Excel/UpgradeAvatarSubTypeExcel.cs
Normal file
31
Common/Data/Excel/UpgradeAvatarSubTypeExcel.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("UpgradeAvatarSubType.json")]
|
||||
public class UpgradeAvatarSubTypeExcel : ExcelResource
|
||||
{
|
||||
[JsonProperty("DJPCAIKIONP")]
|
||||
public uint AvatarId { get; set; }
|
||||
|
||||
[JsonProperty("COACLFEBBDA")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public UpgradeAvatarSubRelicTypeEnum SubType { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
if (AvatarId == 0)
|
||||
{
|
||||
throw new KeyNotFoundException("Upgrade Avatar Should Be Updated!");
|
||||
}
|
||||
|
||||
return (int)AvatarId;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.UpgradeAvatarSubTypeData.TryAdd(AvatarId, this);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ using EggLink.DanhengServer.Enums.TournRogue;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Concurrent;
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using EggLink.DanhengServer.Enums.Item;
|
||||
|
||||
namespace EggLink.DanhengServer.Data;
|
||||
|
||||
@@ -49,6 +51,7 @@ public static class GameData
|
||||
#region Avatar
|
||||
|
||||
public static Dictionary<int, AvatarConfigExcel> AvatarConfigData { get; private set; } = [];
|
||||
public static Dictionary<uint, AvatarRelicRecommendExcel> AvatarRelicRecommendData { get; private set; } = [];
|
||||
public static Dictionary<int, AvatarGlobalBuffConfigExcel> AvatarGlobalBuffConfigData { get; private set; } = [];
|
||||
|
||||
public static Dictionary<int, AdventureAbilityConfigListInfo> AdventureAbilityConfigListData { get; private set; } =
|
||||
@@ -69,6 +72,17 @@ public static class GameData
|
||||
public static Dictionary<int, SummonUnitDataExcel> SummonUnitDataData { get; private set; } = [];
|
||||
public static Dictionary<int, DecideAvatarOrderExcel> DecideAvatarOrderData { get; private set; } = [];
|
||||
public static ConcurrentDictionary<int, CharacterConfigInfo> CharacterConfigInfoData { get; private set; } = [];
|
||||
public static Dictionary<AvatarBaseTypeEnum, UpgradeAvatarEquipmentExcel> UpgradeAvatarEquipmentData { get; private set; } =
|
||||
[];
|
||||
public static Dictionary<uint, UpgradeAvatarSubTypeExcel> UpgradeAvatarSubTypeData { get; private set; } = [];
|
||||
|
||||
public static
|
||||
Dictionary<UpgradeAvatarSubRelicTypeEnum, Dictionary<RarityEnum,
|
||||
Dictionary<uint, Dictionary<RelicTypeEnum, UpgradeAvatarSubRelicExcel>>>> UpgradeAvatarSubRelicData
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = [];
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Database.Inventory;
|
||||
using EggLink.DanhengServer.Database.Player;
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using EggLink.DanhengServer.Enums.Item;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using SqlSugar;
|
||||
using LineupInfo = EggLink.DanhengServer.Database.Lineup.LineupInfo;
|
||||
|
||||
@@ -192,10 +195,31 @@ public class FormalAvatarInfo : BaseAvatarInfo
|
||||
};
|
||||
}
|
||||
|
||||
public override BattleAvatar ToBattleProto(PlayerDataCollection collection,
|
||||
AvatarType avatarType = AvatarType.AvatarFormalType)
|
||||
#region Battle Proto
|
||||
|
||||
public override BattleAvatar ToBattleProto(PlayerDataCollection collection, AvatarType avatarType = AvatarType.AvatarFormalType)
|
||||
{
|
||||
var proto = new BattleAvatar
|
||||
var proto = CreateBaseProto(collection, avatarType);
|
||||
var isUpgradable = IsUpgradableType(avatarType);
|
||||
|
||||
if (!GameData.AvatarConfigData.TryGetValue(AvatarId, out var avatarConf))
|
||||
return proto;
|
||||
|
||||
if (isUpgradable)
|
||||
ApplyMaxLevel(proto);
|
||||
|
||||
ProcessSkills(proto, isUpgradable);
|
||||
ProcessRelics(proto, collection, isUpgradable);
|
||||
ProcessEquipment(proto, collection, isUpgradable, avatarConf);
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
private BattleAvatar CreateBaseProto(PlayerDataCollection collection, AvatarType avatarType)
|
||||
{
|
||||
var isBattle = collection.LineupInfo.LineupType != 0;
|
||||
|
||||
return new BattleAvatar
|
||||
{
|
||||
Id = (uint)AvatarId,
|
||||
AvatarType = avatarType,
|
||||
@@ -203,70 +227,246 @@ public class FormalAvatarInfo : BaseAvatarInfo
|
||||
Promotion = (uint)Promotion,
|
||||
Rank = (uint)GetCurPathInfo().Rank,
|
||||
Index = (uint)collection.LineupInfo.GetSlot(BaseAvatarId),
|
||||
Hp = (uint)GetCurHp(collection.LineupInfo.LineupType != 0),
|
||||
SpBar = new SpBarInfo
|
||||
{
|
||||
CurSp = (uint)GetCurSp(collection.LineupInfo.LineupType != 0),
|
||||
MaxSp = 10000
|
||||
},
|
||||
Hp = (uint)GetCurHp(isBattle),
|
||||
SpBar = new SpBarInfo { CurSp = (uint)GetCurSp(isBattle), MaxSp = 10000 },
|
||||
WorldLevel = (uint)collection.PlayerData.WorldLevel,
|
||||
AvatarEnhanceId = (uint)GetCurPathInfo().EnhanceId
|
||||
};
|
||||
}
|
||||
|
||||
private static bool IsUpgradableType(AvatarType avatarType) =>
|
||||
avatarType is AvatarType.AvatarGridFightType or AvatarType.AvatarUpgradeAvailableType;
|
||||
|
||||
private static void ApplyMaxLevel(BattleAvatar proto)
|
||||
{
|
||||
proto.Level = 80;
|
||||
proto.Promotion = 6;
|
||||
}
|
||||
|
||||
private void ProcessSkills(BattleAvatar proto, bool isUpgradable)
|
||||
{
|
||||
foreach (var (skillId, level) in GetCurPathInfo().GetSkillTree())
|
||||
{
|
||||
var finalLevel = isUpgradable ? GetUpgradedSkillLevel(skillId, level) : level;
|
||||
|
||||
foreach (var skill in GetCurPathInfo().GetSkillTree())
|
||||
proto.SkilltreeList.Add(new AvatarSkillTree
|
||||
{
|
||||
PointId = (uint)skill.Key,
|
||||
Level = (uint)skill.Value
|
||||
});
|
||||
|
||||
foreach (var relic in GetCurPathInfo().Relic)
|
||||
{
|
||||
var item = collection.InventoryData.RelicItems?.Find(item => item.UniqueId == relic.Value);
|
||||
if (item != null)
|
||||
{
|
||||
var protoRelic = new BattleRelic
|
||||
{
|
||||
Id = (uint)item.ItemId,
|
||||
UniqueId = (uint)item.UniqueId,
|
||||
Level = (uint)item.Level,
|
||||
MainAffixId = (uint)item.MainAffix
|
||||
};
|
||||
|
||||
if (item.SubAffixes.Count >= 1)
|
||||
foreach (var subAffix in item.SubAffixes)
|
||||
protoRelic.SubAffixList.Add(subAffix.ToProto());
|
||||
|
||||
proto.RelicList.Add(protoRelic);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetCurPathInfo().EquipId != 0)
|
||||
{
|
||||
var item = collection.InventoryData.EquipmentItems.Find(item => item.UniqueId == GetCurPathInfo().EquipId);
|
||||
if (item != null)
|
||||
proto.EquipmentList.Add(new BattleEquipment
|
||||
{
|
||||
Id = (uint)item.ItemId,
|
||||
Level = (uint)item.Level,
|
||||
Promotion = (uint)item.Promotion,
|
||||
Rank = (uint)item.Rank
|
||||
});
|
||||
}
|
||||
else if (GetCurPathInfo().EquipData != null)
|
||||
{
|
||||
proto.EquipmentList.Add(new BattleEquipment
|
||||
{
|
||||
Id = (uint)GetCurPathInfo().EquipData!.ItemId,
|
||||
Level = (uint)GetCurPathInfo().EquipData!.Level,
|
||||
Promotion = (uint)GetCurPathInfo().EquipData!.Promotion,
|
||||
Rank = (uint)GetCurPathInfo().EquipData!.Rank
|
||||
PointId = (uint)skillId,
|
||||
Level = (uint)finalLevel
|
||||
});
|
||||
}
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
private static int GetUpgradedSkillLevel(int skillId, int currentLevel)
|
||||
{
|
||||
var maxLevel = GameData.AvatarSkillTreeConfigData.GetValueOrDefault(skillId * 100 + currentLevel)?.MaxLevel ?? 1;
|
||||
return Math.Max(Math.Max(1, maxLevel - 2), currentLevel);
|
||||
}
|
||||
|
||||
private void ProcessRelics(BattleAvatar proto, PlayerDataCollection collection, bool isUpgradable)
|
||||
{
|
||||
var relicUpgradeType = GameData.UpgradeAvatarSubTypeData.GetValueOrDefault((uint)AvatarId)?.SubType
|
||||
?? UpgradeAvatarSubRelicTypeEnum.Base;
|
||||
var relicRecommend = GameData.AvatarRelicRecommendData.GetValueOrDefault((uint)AvatarId);
|
||||
|
||||
// Ensure all relic slots exist
|
||||
var equippedRelics = GetCurPathInfo().Relic;
|
||||
for (var slot = 1; slot <= 6; slot++)
|
||||
equippedRelics.TryAdd(slot, 0);
|
||||
|
||||
foreach (var (slot, relicId) in equippedRelics)
|
||||
{
|
||||
var relic = CreateRelicForSlot(slot, relicId, collection, isUpgradable, relicUpgradeType, relicRecommend);
|
||||
if (relic != null)
|
||||
proto.RelicList.Add(relic);
|
||||
}
|
||||
}
|
||||
|
||||
private BattleRelic? CreateRelicForSlot(int slot, int relicId, PlayerDataCollection collection,
|
||||
bool isUpgradable, UpgradeAvatarSubRelicTypeEnum upgradeType, AvatarRelicRecommendExcel? recommend)
|
||||
{
|
||||
var item = collection.InventoryData.RelicItems.Find(x => x.UniqueId == relicId);
|
||||
|
||||
// Use existing relic if not upgradable or already maxed
|
||||
if (item != null && (!isUpgradable || item.Level >= 15 || recommend == null))
|
||||
return CreateRelicFromItem(item);
|
||||
|
||||
// Create internal relic for upgrade scenario
|
||||
return isUpgradable ? CreateInternalRelic(slot, upgradeType, recommend) : null;
|
||||
}
|
||||
|
||||
private static BattleRelic CreateRelicFromItem(ItemData item)
|
||||
{
|
||||
var relic = new BattleRelic
|
||||
{
|
||||
Id = (uint)item.ItemId,
|
||||
UniqueId = (uint)item.UniqueId,
|
||||
Level = (uint)item.Level,
|
||||
MainAffixId = (uint)item.MainAffix
|
||||
};
|
||||
|
||||
item.SubAffixes.ForEach(sub => relic.SubAffixList.Add(sub.ToProto()));
|
||||
return relic;
|
||||
}
|
||||
|
||||
private BattleRelic? CreateInternalRelic(int slot, UpgradeAvatarSubRelicTypeEnum upgradeType, AvatarRelicRecommendExcel? recommend)
|
||||
{
|
||||
if (recommend == null) return null;
|
||||
|
||||
var slotType = (RelicTypeEnum)slot;
|
||||
var relicSet = GetRecommendedRelicSet(slot, recommend);
|
||||
var relicInfo = GetRelicUpgradeInfo(upgradeType, slotType);
|
||||
var relicItem = FindRelicConfig(relicSet, slotType);
|
||||
|
||||
if (relicInfo == null || relicItem == null) return null;
|
||||
|
||||
var mainAffixId = GetMainAffixId(slot, recommend, relicItem);
|
||||
if (mainAffixId == 0) return null;
|
||||
|
||||
return BuildBattleRelic(relicItem, mainAffixId, relicInfo);
|
||||
}
|
||||
|
||||
private static uint GetRecommendedRelicSet(int slot, AvatarRelicRecommendExcel recommend) =>
|
||||
slot <= 4 ? recommend.Set4IDList.First() : recommend.Set2IDList.First();
|
||||
|
||||
private UpgradeAvatarSubRelicExcel? GetRelicUpgradeInfo(UpgradeAvatarSubRelicTypeEnum upgradeType, RelicTypeEnum slotType) =>
|
||||
GameData.UpgradeAvatarSubRelicData.GetValueOrDefault(upgradeType, [])
|
||||
.GetValueOrDefault(RarityEnum.CombatPowerRelicRarity5, [])
|
||||
.GetValueOrDefault(15u, [])
|
||||
.GetValueOrDefault(slotType);
|
||||
|
||||
private static RelicConfigExcel? FindRelicConfig(uint relicSet, RelicTypeEnum slotType) =>
|
||||
GameData.RelicConfigData.Values.FirstOrDefault(x =>
|
||||
x.SetID == relicSet && x.Rarity == RarityEnum.CombatPowerRelicRarity5 && x.Type == slotType);
|
||||
|
||||
private uint GetMainAffixId(int slot, AvatarRelicRecommendExcel recommend, RelicConfigExcel relicItem)
|
||||
{
|
||||
var mainAffix = recommend.PropertyList.FirstOrDefault(x => x.RelicType == (RelicTypeEnum)slot)?.PropertyType;
|
||||
|
||||
if (mainAffix == null)
|
||||
return GetRandomRelicMainAffix(relicItem.ID);
|
||||
|
||||
return (uint)(GameData.RelicMainAffixData[relicItem.MainAffixGroup].Values
|
||||
.FirstOrDefault(x => x.Property == mainAffix)?.AffixID ?? 0);
|
||||
}
|
||||
|
||||
private static BattleRelic BuildBattleRelic(RelicConfigExcel relicItem, uint mainAffixId, UpgradeAvatarSubRelicExcel relicInfo)
|
||||
{
|
||||
var battleRelic = new BattleRelic
|
||||
{
|
||||
Id = (uint)relicItem.ID,
|
||||
Level = 15,
|
||||
MainAffixId = mainAffixId
|
||||
};
|
||||
|
||||
foreach (var relic in relicInfo.SubAffixes)
|
||||
{
|
||||
var subAffixConf = GameData.RelicSubAffixData[relicItem.SubAffixGroup].Values
|
||||
.FirstOrDefault(x => x.Property == relic.AffixProperty);
|
||||
if (subAffixConf == null) continue;
|
||||
|
||||
battleRelic.SubAffixList.Add(new RelicAffix
|
||||
{
|
||||
AffixId = (uint)subAffixConf.AffixID,
|
||||
Cnt = relic.AffixCount,
|
||||
Step = (uint)(relic.AffixCount * subAffixConf.StepNum)
|
||||
});
|
||||
}
|
||||
|
||||
return battleRelic;
|
||||
}
|
||||
|
||||
private void ProcessEquipment(BattleAvatar proto, PlayerDataCollection collection, bool isUpgradable, AvatarConfigExcel avatarConf)
|
||||
{
|
||||
var equipId = GetCurPathInfo().EquipId;
|
||||
var equipData = GetCurPathInfo().EquipData;
|
||||
|
||||
if (equipId != 0)
|
||||
{
|
||||
var item = collection.InventoryData.EquipmentItems.Find(x => x.UniqueId == equipId);
|
||||
if (item != null)
|
||||
proto.EquipmentList.Add(CreateEquipmentFromItem(item, isUpgradable, avatarConf));
|
||||
}
|
||||
else if (equipData != null)
|
||||
{
|
||||
proto.EquipmentList.Add(CreateEquipmentFromData(equipData));
|
||||
}
|
||||
else if (isUpgradable)
|
||||
{
|
||||
var internalEquip = CreateInternalEquipment(avatarConf);
|
||||
if (internalEquip != null)
|
||||
proto.EquipmentList.Add(internalEquip);
|
||||
}
|
||||
}
|
||||
|
||||
private BattleEquipment CreateEquipmentFromItem(ItemData item, bool isUpgradable, AvatarConfigExcel avatarConf)
|
||||
{
|
||||
var (itemId, level, promotion, rank) = (item.ItemId, item.Level, item.Promotion, item.Rank);
|
||||
|
||||
if (isUpgradable)
|
||||
(itemId, level, promotion, rank) = UpgradeEquipment(itemId, rank, avatarConf);
|
||||
|
||||
return new BattleEquipment
|
||||
{
|
||||
Id = (uint)itemId,
|
||||
Level = (uint)level,
|
||||
Promotion = (uint)promotion,
|
||||
Rank = (uint)rank
|
||||
};
|
||||
}
|
||||
|
||||
private (int itemId, int level, int promotion, int rank) UpgradeEquipment(int itemId, int rank, AvatarConfigExcel avatarConf)
|
||||
{
|
||||
if (GameData.EquipmentConfigData.TryGetValue(itemId, out var equipConf) &&
|
||||
equipConf.Rarity is RarityEnum.CombatPowerLightconeRarity3)
|
||||
{
|
||||
if (GameData.UpgradeAvatarEquipmentData.TryGetValue(avatarConf.AvatarBaseType, out var equipInfo))
|
||||
{
|
||||
itemId = (int)equipInfo.EquipmentId;
|
||||
equipConf = GameData.EquipmentConfigData.GetValueOrDefault(itemId);
|
||||
}
|
||||
|
||||
return (itemId, 80, equipConf?.MaxPromotion ?? 6, 1);
|
||||
}
|
||||
|
||||
return (itemId, 80, 6, rank);
|
||||
}
|
||||
|
||||
private static BattleEquipment CreateEquipmentFromData(ItemData data) => new()
|
||||
{
|
||||
Id = (uint)data.ItemId,
|
||||
Level = (uint)data.Level,
|
||||
Promotion = (uint)data.Promotion,
|
||||
Rank = (uint)data.Rank
|
||||
};
|
||||
|
||||
private static BattleEquipment? CreateInternalEquipment(AvatarConfigExcel avatarConf)
|
||||
{
|
||||
if (!GameData.UpgradeAvatarEquipmentData.TryGetValue(avatarConf.AvatarBaseType, out var equipInfo))
|
||||
return null;
|
||||
|
||||
return new BattleEquipment
|
||||
{
|
||||
Id = equipInfo.EquipmentId,
|
||||
Level = 80,
|
||||
Promotion = 6,
|
||||
Rank = 1
|
||||
};
|
||||
}
|
||||
|
||||
public uint GetRandomRelicMainAffix(int itemId)
|
||||
{
|
||||
GameData.RelicConfigData.TryGetValue(itemId, out var config);
|
||||
if (config == null) return 0;
|
||||
GameData.RelicMainAffixData.TryGetValue(config.MainAffixGroup, out var affixes);
|
||||
if (affixes == null) return 0;
|
||||
List<uint> affixList = [];
|
||||
affixList.AddRange(from affix in affixes.Values select (uint)affix.AffixID);
|
||||
return affixList.RandomElement();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ChallengePeakAvatar ToPeakAvatarProto()
|
||||
{
|
||||
return new ChallengePeakAvatar
|
||||
|
||||
@@ -98,8 +98,7 @@ public class ItemData
|
||||
{
|
||||
var subId = subAffixKeys.RandomElement();
|
||||
if (SubAffixes.Any(x => x.Id == subId)) continue;
|
||||
if (subAffixConfig[subId] != null &&
|
||||
subAffixConfig[subId].Property == mainProperty) continue;
|
||||
if (subAffixConfig[subId].Property == mainProperty) continue;
|
||||
|
||||
SubAffixes.Add(new ItemSubAffix(subAffixConfig[subId], 1));
|
||||
count--;
|
||||
|
||||
14
Common/Enums/Avatar/AvatarBaseTypeEnum.cs
Normal file
14
Common/Enums/Avatar/AvatarBaseTypeEnum.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace EggLink.DanhengServer.Enums.Avatar;
|
||||
|
||||
public enum AvatarBaseTypeEnum
|
||||
{
|
||||
Unknown = 0,
|
||||
Warrior = 1,
|
||||
Rogue = 2,
|
||||
Mage = 3,
|
||||
Shaman = 4,
|
||||
Warlock = 5,
|
||||
Knight = 6,
|
||||
Priest = 7,
|
||||
Memory = 8
|
||||
}
|
||||
136
Common/Enums/Avatar/AvatarPropertyTypeEnum.cs
Normal file
136
Common/Enums/Avatar/AvatarPropertyTypeEnum.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
namespace EggLink.DanhengServer.Enums.Avatar;
|
||||
|
||||
public enum AvatarPropertyTypeEnum
|
||||
{
|
||||
Unknown = 0,
|
||||
MaxHP = 1,
|
||||
Attack = 2,
|
||||
Defence = 3,
|
||||
Speed = 4,
|
||||
CriticalChance = 5,
|
||||
CriticalDamage = 6,
|
||||
HealRatio = 7,
|
||||
StanceBreakAddedRatio = 8,
|
||||
SPRatio = 9,
|
||||
StatusProbability = 10,
|
||||
StatusResistance = 11,
|
||||
PhysicalAddedRatio = 12,
|
||||
PhysicalResistance = 13,
|
||||
FireAddedRatio = 14,
|
||||
FireResistance = 15,
|
||||
IceAddedRatio = 16,
|
||||
IceResistance = 17,
|
||||
ThunderAddedRatio = 18,
|
||||
ThunderResistance = 19,
|
||||
WindAddedRatio = 20,
|
||||
WindResistance = 21,
|
||||
QuantumAddedRatio = 22,
|
||||
QuantumResistance = 23,
|
||||
ImaginaryAddedRatio = 24,
|
||||
ImaginaryResistance = 25,
|
||||
BaseHP = 26,
|
||||
HPDelta = 27,
|
||||
BaseAttack = 28,
|
||||
AttackDelta = 29,
|
||||
BaseDefence = 30,
|
||||
DefenceDelta = 31,
|
||||
HPAddedRatio = 32,
|
||||
AttackAddedRatio = 33,
|
||||
DefenceAddedRatio = 34,
|
||||
BaseSpeed = 35,
|
||||
HealTakenRatio = 36,
|
||||
PhysicalResistanceDelta = 37,
|
||||
FireResistanceDelta = 38,
|
||||
IceResistanceDelta = 39,
|
||||
ThunderResistanceDelta = 40,
|
||||
WindResistanceDelta = 41,
|
||||
QuantumResistanceDelta = 42,
|
||||
ImaginaryResistanceDelta = 43,
|
||||
AllDamageReduce = 44,
|
||||
RelicValueExtraAdditionRatio = 45,
|
||||
EquipValueExtraAdditionRatio = 46,
|
||||
EquipExtraRank = 47,
|
||||
AvatarExtraRank = 48,
|
||||
AllDamageTypeAddedRatio = 49,
|
||||
SpeedAddedRatio = 50,
|
||||
SpeedDelta = 51,
|
||||
CriticalChanceBase = 52,
|
||||
CriticalDamageBase = 53,
|
||||
SPRatioBase = 54,
|
||||
HealRatioBase = 55,
|
||||
StatusProbabilityBase = 56,
|
||||
StatusResistanceBase = 57,
|
||||
BreakDamageAddedRatio = 58,
|
||||
BreakDamageAddedRatioBase = 59,
|
||||
MaxSP = 60,
|
||||
SpecialMaxSP = 61,
|
||||
PhysicalPenetrate = 62,
|
||||
FirePenetrate = 63,
|
||||
IcePenetrate = 64,
|
||||
ThunderPenetrate = 65,
|
||||
WindPenetrate = 66,
|
||||
QuantumPenetrate = 67,
|
||||
ImaginaryPenetrate = 68,
|
||||
AllDamageTypePenetrate = 69,
|
||||
BreakDamageExtraAddedRatio = 70,
|
||||
ExtraAttackAddedRatio1 = 1001,
|
||||
ExtraAttackAddedRatio2 = 1002,
|
||||
ExtraAttackAddedRatio3 = 1003,
|
||||
ExtraAttackAddedRatio4 = 1004,
|
||||
ExtraDefenceAddedRatio1 = 1005,
|
||||
ExtraDefenceAddedRatio2 = 1006,
|
||||
ExtraDefenceAddedRatio3 = 1007,
|
||||
ExtraDefenceAddedRatio4 = 1008,
|
||||
ExtraHPAddedRatio1 = 1009,
|
||||
ExtraHPAddedRatio2 = 1010,
|
||||
ExtraHPAddedRatio3 = 1011,
|
||||
ExtraHPAddedRatio4 = 1012,
|
||||
ExtraHealAddedRatio = 1013,
|
||||
ExtraAllDamageTypeAddedRatio1 = 1014,
|
||||
ExtraAllDamageTypeAddedRatio2 = 1015,
|
||||
ExtraAllDamageTypeAddedRatio3 = 1016,
|
||||
ExtraAllDamageTypeAddedRatio4 = 1017,
|
||||
ExtraAllDamageReduce = 1018,
|
||||
ExtraShieldAddedRatio = 1019,
|
||||
ExtraSpeedAddedRatio1 = 1020,
|
||||
ExtraSpeedAddedRatio2 = 1021,
|
||||
ExtraSpeedAddedRatio3 = 1022,
|
||||
ExtraSpeedAddedRatio4 = 1023,
|
||||
ExtraLuckChance = 1024,
|
||||
ExtraLuckDamage = 1025,
|
||||
ExtraFrontPowerBase = 1026,
|
||||
ExtraFrontPowerAddedRatio1 = 1027,
|
||||
ExtraFrontPowerAddedRatio2 = 1028,
|
||||
ExtraBackPowerBase = 1029,
|
||||
ExtraBackPowerAddedRatio1 = 1030,
|
||||
ExtraBackPowerAddedRatio2 = 1031,
|
||||
ExtraUltraDamageAddedRatio1 = 1032,
|
||||
ExtraSkillDamageAddedRatio1 = 1033,
|
||||
ExtraNormalDamageAddedRatio1 = 1034,
|
||||
ExtraInsertDamageAddedRatio1 = 1035,
|
||||
ExtraTotalFrontPower = 1036,
|
||||
ExtraTotalBackPower = 1037,
|
||||
ExtraDOTDamageAddedRatio1 = 1038,
|
||||
ExtraHealBase = 1039,
|
||||
ExtraShieldBase = 1040,
|
||||
ExtraTotalShieldPower = 1041,
|
||||
ExtraTotalHealPower = 1042,
|
||||
ExtraTotalSpeedAddedRatio = 1043,
|
||||
ExtraEnergyBar = 1044,
|
||||
ExtraInitSP = 1045,
|
||||
ExtraElementDamageAddedRatio1 = 1046,
|
||||
ExtraTotalLuckChance = 1047,
|
||||
ExtraLuckChanceBase = 1048,
|
||||
ExtraTotalLuckDamage = 1049,
|
||||
ExtraLuckDamageBase = 1050,
|
||||
ExtraDamageAddedRatio1 = 1051,
|
||||
ExtraQuantumResonance = 1052,
|
||||
ExtraFrontPowerConvert = 1053,
|
||||
ExtraBackPowerConvert = 1054,
|
||||
ExtraLuckDamageConvert = 1055,
|
||||
ExtraLuckChanceConvert = 1056,
|
||||
ExtraHealConvert = 1057,
|
||||
ExtraShieldConvert = 1058,
|
||||
ExtraAllDamageReduceConvert = 1059,
|
||||
ExtraTotalAllDamageReduce = 1060
|
||||
}
|
||||
14
Common/Enums/Avatar/UpgradeAvatarSubRelicTypeEnum.cs
Normal file
14
Common/Enums/Avatar/UpgradeAvatarSubRelicTypeEnum.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace EggLink.DanhengServer.Enums.Avatar;
|
||||
|
||||
public enum UpgradeAvatarSubRelicTypeEnum
|
||||
{
|
||||
None = 0,
|
||||
Base = 1,
|
||||
LowSpeed = 2,
|
||||
HighSpeed = 3,
|
||||
HighAttack = 4,
|
||||
HighDefence = 5,
|
||||
HighHP = 6,
|
||||
HighBreakDamage = 7,
|
||||
DOT = 8
|
||||
}
|
||||
Reference in New Issue
Block a user