diff --git a/AscNet.Common/AscNet.Common.csproj b/AscNet.Common/AscNet.Common.csproj index cf41343..875bb25 100644 --- a/AscNet.Common/AscNet.Common.csproj +++ b/AscNet.Common/AscNet.Common.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/AscNet.Common/MsgPack/Types.cs b/AscNet.Common/MsgPack/Types.cs index 12d1861..2ac923d 100644 --- a/AscNet.Common/MsgPack/Types.cs +++ b/AscNet.Common/MsgPack/Types.cs @@ -105,10 +105,17 @@ namespace AscNet.Common.MsgPack [MessagePackObject(true)] public partial class ResonanceInfo { - public long Slot { get; set; } - public long Type { get; set; } - public long CharacterId { get; set; } - public long TemplateId { get; set; } + public int Slot { get; set; } + public EquipResonanceType Type { get; set; } + public int CharacterId { get; set; } + public int TemplateId { get; set; } + } + + public enum EquipResonanceType + { + Attrib = 1, + CharacterSkill = 2, + WeaponSkill = 3, } [MessagePackObject(true)] @@ -345,15 +352,15 @@ namespace AscNet.Common.MsgPack [global::MessagePack.MessagePackObject(true)] public class NotifyEquipChipAutoRecycleSite { - [global::MessagePack.MessagePackObject(true)] - public class NotifyEquipChipAutoRecycleSiteChipRecycleSite - { - public List RecycleStar { get; set; } = new(); - public Int32 Days { get; set; } - public Int32 SetRecycleTime { get; set; } - } + public ChipRecycleSite ChipRecycleSite { get; set; } + } - public NotifyEquipChipAutoRecycleSiteChipRecycleSite ChipRecycleSite { get; set; } + [global::MessagePack.MessagePackObject(true)] + public class ChipRecycleSite + { + public List RecycleStar { get; set; } = new(); + public Int32 Days { get; set; } + public Int32 SetRecycleTime { get; set; } } diff --git a/AscNet.GameServer/AscNet.GameServer.csproj b/AscNet.GameServer/AscNet.GameServer.csproj index 2b51d6c..7445fe4 100644 --- a/AscNet.GameServer/AscNet.GameServer.csproj +++ b/AscNet.GameServer/AscNet.GameServer.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/AscNet.GameServer/Handlers/AwarenessModule.cs b/AscNet.GameServer/Handlers/AwarenessModule.cs index 9bdc437..4f55924 100644 --- a/AscNet.GameServer/Handlers/AwarenessModule.cs +++ b/AscNet.GameServer/Handlers/AwarenessModule.cs @@ -1,9 +1,4 @@ using MessagePack; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace AscNet.GameServer.Handlers { diff --git a/AscNet.GameServer/Handlers/EquipModule.cs b/AscNet.GameServer/Handlers/EquipModule.cs index 86e0019..4e73b86 100644 --- a/AscNet.GameServer/Handlers/EquipModule.cs +++ b/AscNet.GameServer/Handlers/EquipModule.cs @@ -4,6 +4,7 @@ using AscNet.Common.MsgPack; using AscNet.Common.Util; using AscNet.Table.V2.share.equip; using AscNet.Table.V2.share.item; +using AscNet.Table.V2.share.attrib; using MessagePack; namespace AscNet.GameServer.Handlers @@ -35,6 +36,25 @@ namespace AscNet.GameServer.Handlers public int Code; } + [MessagePackObject(true)] + public class EquipResonanceRequest + { + public int EquipId; + public int Slot; + public int? UseItemId; + public int? UseEquipId; + public int? SelectSkillId; + public int? CharacterId; + public EquipResonanceType? SelectType; + } + + [MessagePackObject(true)] + public class EquipResonanceResponse + { + public int Code; + public ResonanceInfo ResonanceData; + } + [MessagePackObject(true)] public class EquipPutOnRequest { @@ -234,5 +254,78 @@ namespace AscNet.GameServer.Handlers session.SendResponse(new EquipTakeOffResponse(), packet.Id); } + + // TODO: Swapping equip resonance is broken! + [RequestPacketHandler("EquipResonanceRequest")] + public static void EquipResonanceRequestHandler(Session session, Packet.Request packet) + { + EquipResonanceRequest request = packet.Deserialize(); + + var equip = session.character.Equips.Find(x => x.Id == request.EquipId); + + if (equip is null) + { + // EquipManagerGetCharEquipBySiteNotFound + session.SendResponse(new EquipResonanceResponse() { Code = 20021012 }, packet.Id); + return; + } + + #region Pools + EquipResonanceTable? equipResonance = TableReaderV2.Parse().Find(x => x.Id == equip.TemplateId); + List resonancePool = new(); + foreach (var attribPoolId in equipResonance?.AttribPoolId ?? []) + { + var attribPool = TableReaderV2.Parse().Where(x => x.PoolId == attribPoolId); + foreach (var attrib in attribPool) + { + resonancePool.Add(new() + { + Slot = request.Slot, + Type = EquipResonanceType.Attrib, + TemplateId = attrib.Id + }); + } + } + foreach (var characterSkillPoolId in equipResonance?.CharacterSkillPoolId ?? []) + { + throw new NotImplementedException(); + } + foreach (var weaponSkillPoolId in equipResonance?.WeaponSkillPoolId ?? []) + { + throw new NotImplementedException(); + } + #endregion + + if (request.UseItemId is not null && request.UseItemId > 0) + { + EquipResonanceUseItemTable? resonanceUseItem = TableReaderV2.Parse().Find(x => x.Id == equip.TemplateId); + if (resonanceUseItem is not null) + { + NotifyItemDataList notifyItemData = new(); + for (int i = 0; i < Math.Min(resonanceUseItem.ItemId.Count, resonanceUseItem.ItemCount.Count); i++) + { + notifyItemData.ItemDataList.Add(session.inventory.Do(resonanceUseItem.ItemId[i], resonanceUseItem.ItemCount[i] * -1)); + } + + session.SendPush(notifyItemData); + } + else + { + session.log.Error($"EquipResonanceUseItem for template {equip.TemplateId} not found!"); + // EquipResonanceUseItemTemplateNotFound + session.SendResponse(new EquipResonanceResponse() { Code = 20021038 }, packet.Id); + return; + } + } + else if (request.UseEquipId is not null && request.UseEquipId > 0) + { + throw new NotImplementedException(); + } + + ResonanceInfo resonance = resonancePool[Random.Shared.Next(resonancePool.Count)]; + equip.ResonanceInfo.Add(resonance); + + session.SendResponse(new EquipResonanceResponse() { ResonanceData = resonance }, packet.Id); + } } } diff --git a/AscNet.Logging/AscNet.Logging.csproj b/AscNet.Logging/AscNet.Logging.csproj index cfadb03..30402ac 100644 --- a/AscNet.Logging/AscNet.Logging.csproj +++ b/AscNet.Logging/AscNet.Logging.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/AscNet.SDKServer/AscNet.SDKServer.csproj b/AscNet.SDKServer/AscNet.SDKServer.csproj index 35b5773..cd18652 100644 --- a/AscNet.SDKServer/AscNet.SDKServer.csproj +++ b/AscNet.SDKServer/AscNet.SDKServer.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable Library diff --git a/AscNet.Test/AscNet.Test.csproj b/AscNet.Test/AscNet.Test.csproj index 95db04c..2b8d0a7 100644 --- a/AscNet.Test/AscNet.Test.csproj +++ b/AscNet.Test/AscNet.Test.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable diff --git a/AscNet/AscNet.csproj b/AscNet/AscNet.csproj index d190923..1ff6e2e 100644 --- a/AscNet/AscNet.csproj +++ b/AscNet/AscNet.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable diff --git a/Resources/table/share/attrib/AttribPool.tsv b/Resources/table/share/attrib/AttribPool.tsv new file mode 100644 index 0000000..c6b3082 --- /dev/null +++ b/Resources/table/share/attrib/AttribPool.tsv @@ -0,0 +1,42 @@ +Id PoolId Weight AttribId AttribGrowRateId Icon Name Description MaxAttribDesc +1 1 100 1010210 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I ATK +10 +2 1 100 1010211 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I DEF +10 +3 1 100 1010212 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I HP +200 +4 1 100 1010213 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I CRIT +10 +5 2 100 500 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I ATK +2.5% +6 2 100 501 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I DEF +1% +7 2 100 502 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I CRIT +10% +8 2 100 503 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I HP +5% +9 2 100 504 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I HP +5% +10 3 100 501 ATK +2.5% (Max +5%) +11 3 100 502 DEF +1% (Max +8%) +12 3 100 503 CRIT +10% (Max +15%) +13 3 100 504 HP +5% (Max +10%) +14 3 100 9 ATK +10 (Max +15) +15 3 100 9 DEF +10 (Max +15) +16 3 100 9 HP +200 (Max +300) +17 3 100 9 CRIT +10 (Max +15) +18 3 100 501 ATK +2.5% (Max +5%) +19 3 100 502 DEF +1% (Max +8%) +20 5 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack I ATK +30, CRIT +30 +21 5 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack I ATK +30, CRIT +30 +22 8 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack II ATK +30, CRIT +30 +23 8 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack II ATK +30, CRIT +30 +24 9 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack III ATK +30, CRIT +30 +25 9 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack III ATK +30, CRIT +30 +26 6 100 201001 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingZhuangjiaqianghua.png Tactical Adjustment - Basic HP +50, ATK +10 +27 6 100 201003 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingmixingdong.png Precision Action - Basic HP +50, CRIT +10 +28 6 100 201004 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingChuliqiangji.png Enhanced Power - Basic ATK +10, DEF +15 +29 6 100 201005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack - Basic ATK +10, CRIT +10 +30 7 100 202001 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingZhuangjiaqianghua.png Ex - Tactical Adjustment HP +75, ATK +15 +31 7 100 202003 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingmixingdong.png Ex - Precision Action HP +75, CRIT +15 +32 7 100 202004 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingChuliqiangji.png Ex - Enhanced Power ATK +15, DEF +23 +33 7 100 202005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Ex - Precision Attack ATK +15, CRIT +15 +1001 1001 100 900001 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats +1002 1002 100 900002 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats +1003 1003 100 900003 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats +1004 1004 100 900004 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats +1005 1005 100 900005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats +1006 1006 100 900006 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats +1007 1007 100 900007 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats +1008 1008 100 900008 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats \ No newline at end of file