forked from PGR/ascnet
1
0
Fork 0

adding resonance, swapping is unsupported!

This commit is contained in:
rfi 2024-01-24 20:33:29 +07:00
parent 27d960c4ba
commit 5c296af253
10 changed files with 160 additions and 23 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -105,10 +105,17 @@ namespace AscNet.Common.MsgPack
[MessagePackObject(true)] [MessagePackObject(true)]
public partial class ResonanceInfo public partial class ResonanceInfo
{ {
public long Slot { get; set; } public int Slot { get; set; }
public long Type { get; set; } public EquipResonanceType Type { get; set; }
public long CharacterId { get; set; } public int CharacterId { get; set; }
public long TemplateId { get; set; } public int TemplateId { get; set; }
}
public enum EquipResonanceType
{
Attrib = 1,
CharacterSkill = 2,
WeaponSkill = 3,
} }
[MessagePackObject(true)] [MessagePackObject(true)]
@ -345,17 +352,17 @@ namespace AscNet.Common.MsgPack
[global::MessagePack.MessagePackObject(true)] [global::MessagePack.MessagePackObject(true)]
public class NotifyEquipChipAutoRecycleSite public class NotifyEquipChipAutoRecycleSite
{ {
public ChipRecycleSite ChipRecycleSite { get; set; }
}
[global::MessagePack.MessagePackObject(true)] [global::MessagePack.MessagePackObject(true)]
public class NotifyEquipChipAutoRecycleSiteChipRecycleSite public class ChipRecycleSite
{ {
public List<Int32> RecycleStar { get; set; } = new(); public List<Int32> RecycleStar { get; set; } = new();
public Int32 Days { get; set; } public Int32 Days { get; set; }
public Int32 SetRecycleTime { get; set; } public Int32 SetRecycleTime { get; set; }
} }
public NotifyEquipChipAutoRecycleSiteChipRecycleSite ChipRecycleSite { get; set; }
}
[global::MessagePack.MessagePackObject(true)] [global::MessagePack.MessagePackObject(true)]
public class NotifyEquipGuideData public class NotifyEquipGuideData

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,9 +1,4 @@
using MessagePack; using MessagePack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AscNet.GameServer.Handlers namespace AscNet.GameServer.Handlers
{ {

View File

@ -4,6 +4,7 @@ using AscNet.Common.MsgPack;
using AscNet.Common.Util; using AscNet.Common.Util;
using AscNet.Table.V2.share.equip; using AscNet.Table.V2.share.equip;
using AscNet.Table.V2.share.item; using AscNet.Table.V2.share.item;
using AscNet.Table.V2.share.attrib;
using MessagePack; using MessagePack;
namespace AscNet.GameServer.Handlers namespace AscNet.GameServer.Handlers
@ -35,6 +36,25 @@ namespace AscNet.GameServer.Handlers
public int Code; 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)] [MessagePackObject(true)]
public class EquipPutOnRequest public class EquipPutOnRequest
{ {
@ -234,5 +254,78 @@ namespace AscNet.GameServer.Handlers
session.SendResponse(new EquipTakeOffResponse(), packet.Id); 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<EquipResonanceRequest>();
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<EquipResonanceTable>().Find(x => x.Id == equip.TemplateId);
List<ResonanceInfo> resonancePool = new();
foreach (var attribPoolId in equipResonance?.AttribPoolId ?? [])
{
var attribPool = TableReaderV2.Parse<AttribPoolTable>().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<EquipResonanceUseItemTable>().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);
}
} }
} }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -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
1 Id PoolId Weight AttribId AttribGrowRateId Icon Name Description MaxAttribDesc
2 1 1 100 1010210 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I ATK +10
3 2 1 100 1010211 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I DEF +10
4 3 1 100 1010212 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I HP +200
5 4 1 100 1010213 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I CRIT +10
6 5 2 100 500 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I ATK +2.5%
7 6 2 100 501 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I DEF +1%
8 7 2 100 502 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I CRIT +10%
9 8 2 100 503 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I HP +5%
10 9 2 100 504 Assets/Product/Texture/Image/IconcurrencySp/IconConsumeMoneySp.png Stats Pool I HP +5%
11 10 3 100 501 ATK +2.5% (Max +5%)
12 11 3 100 502 DEF +1% (Max +8%)
13 12 3 100 503 CRIT +10% (Max +15%)
14 13 3 100 504 HP +5% (Max +10%)
15 14 3 100 9 ATK +10 (Max +15)
16 15 3 100 9 DEF +10 (Max +15)
17 16 3 100 9 HP +200 (Max +300)
18 17 3 100 9 CRIT +10 (Max +15)
19 18 3 100 501 ATK +2.5% (Max +5%)
20 19 3 100 502 DEF +1% (Max +8%)
21 20 5 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack I ATK +30, CRIT +30
22 21 5 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack I ATK +30, CRIT +30
23 22 8 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack II ATK +30, CRIT +30
24 23 8 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack II ATK +30, CRIT +30
25 24 9 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack III ATK +30, CRIT +30
26 25 9 100 200005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack III ATK +30, CRIT +30
27 26 6 100 201001 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingZhuangjiaqianghua.png Tactical Adjustment - Basic HP +50, ATK +10
28 27 6 100 201003 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingmixingdong.png Precision Action - Basic HP +50, CRIT +10
29 28 6 100 201004 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingChuliqiangji.png Enhanced Power - Basic ATK +10, DEF +15
30 29 6 100 201005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Precision Attack - Basic ATK +10, CRIT +10
31 30 7 100 202001 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingZhuangjiaqianghua.png Ex - Tactical Adjustment HP +75, ATK +15
32 31 7 100 202003 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingmixingdong.png Ex - Precision Action HP +75, CRIT +15
33 32 7 100 202004 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingChuliqiangji.png Ex - Enhanced Power ATK +15, DEF +23
34 33 7 100 202005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png Ex - Precision Attack ATK +15, CRIT +15
35 1001 1001 100 900001 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats
36 1002 1002 100 900002 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats
37 1003 1003 100 900003 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats
38 1004 1004 100 900004 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats
39 1005 1005 100 900005 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats
40 1006 1006 100 900006 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats
41 1007 1007 100 900007 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats
42 1008 1008 100 900008 Assets/Product/Texture/Image/IconSkill/IconSkillEquipShuxingJingzhungongji.png RPG Stats