diff --git a/AscNet.Common/Database/Character.cs b/AscNet.Common/Database/Character.cs
index 09165dc3..9dc4e47a 100644
--- a/AscNet.Common/Database/Character.cs
+++ b/AscNet.Common/Database/Character.cs
@@ -77,7 +77,7 @@ namespace AscNet.Common.Database
throw new ServerCodeException("Character already obtained!", 20009022);
}
- NotifyCharacterDataList.NotifyCharacterDataListCharacterData characterData = new()
+ NotifyCharacterDataList.CharacterData characterData = new()
{
Id = (uint)character.Id,
Level = 1,
@@ -98,7 +98,7 @@ namespace AscNet.Common.Database
HeadFashionType = 0
}
};
- characterData.SkillList.AddRange(characterSkill.SkillGroupId.Take(8).Select(x => new NotifyCharacterDataList.NotifyCharacterDataListCharacterData.NotifyCharacterDataListCharacterDataSkill()
+ characterData.SkillList.AddRange(characterSkill.SkillGroupId.Take(8).Select(x => new NotifyCharacterDataList.CharacterData.CharacterSkill()
{
Id = uint.Parse(x.ToString().Take(6).ToArray()),
Level = 1
@@ -118,7 +118,7 @@ namespace AscNet.Common.Database
return ret;
}
- public NotifyCharacterDataList.NotifyCharacterDataListCharacterData? AddCharacterExp(int characterId, int exp, int maxLvl = 0)
+ public NotifyCharacterDataList.CharacterData? AddCharacterExp(int characterId, int exp, int maxLvl = 0)
{
var characterData = TableReaderV2.Parse
().FirstOrDefault(x => x.Id == characterId);
var character = Characters.FirstOrDefault(x => x.Id == characterId);
@@ -254,7 +254,7 @@ namespace AscNet.Common.Database
[BsonElement("characters")]
[BsonRequired]
- public List Characters { get; set; }
+ public List Characters { get; set; }
[BsonElement("equips")]
[BsonRequired]
@@ -304,7 +304,7 @@ namespace AscNet.Common.Database
public struct AddCharacterRet
{
- public NotifyCharacterDataList.NotifyCharacterDataListCharacterData Character { get; set; }
+ public NotifyCharacterDataList.CharacterData Character { get; set; }
public NotifyEquipDataList.NotifyEquipDataListEquipData Equip { get; set; }
public FashionList Fashion { get; set; }
}
diff --git a/AscNet.Common/MsgPack/Types.cs b/AscNet.Common/MsgPack/Types.cs
index 56995c93..945dddfd 100644
--- a/AscNet.Common/MsgPack/Types.cs
+++ b/AscNet.Common/MsgPack/Types.cs
@@ -2527,7 +2527,7 @@ namespace AscNet.Common.MsgPack
public class NotifyCharacterDataList
{
[global::MessagePack.MessagePackObject(true)]
- public class NotifyCharacterDataListCharacterData
+ public class CharacterData
{
public UInt32 Id { get; set; }
public Int32 Level { get; set; }
@@ -2537,13 +2537,13 @@ namespace AscNet.Common.MsgPack
public Int32 Star { get; set; }
public Int32 Grade { get; set; }
[global::MessagePack.MessagePackObject(true)]
- public class NotifyCharacterDataListCharacterDataSkill
+ public class CharacterSkill
{
public UInt32 Id { get; set; }
public Int32 Level { get; set; }
}
- public List SkillList { get; set; } = new();
+ public List SkillList { get; set; } = new();
public List EnhanceSkillList { get; set; } = new();
public UInt32 FashionId { get; set; }
public Int64 CreateTime { get; set; }
@@ -2552,16 +2552,16 @@ namespace AscNet.Common.MsgPack
public Int32 Ability { get; set; }
public Int32 LiberateLv { get; set; }
[global::MessagePack.MessagePackObject(true)]
- public class NotifyCharacterDataListCharacterDataCharacterHeadInfo
+ public class CharacterHead
{
public UInt32 HeadFashionId { get; set; }
public Int32 HeadFashionType { get; set; }
}
- public NotifyCharacterDataListCharacterDataCharacterHeadInfo CharacterHeadInfo { get; set; }
+ public CharacterHead CharacterHeadInfo { get; set; }
}
- public List CharacterDataList { get; set; } = new();
+ public List CharacterDataList { get; set; } = new();
}
diff --git a/AscNet.GameServer/Handlers/CharacterModule.cs b/AscNet.GameServer/Handlers/CharacterModule.cs
index 3e0aa064..06476d21 100644
--- a/AscNet.GameServer/Handlers/CharacterModule.cs
+++ b/AscNet.GameServer/Handlers/CharacterModule.cs
@@ -7,6 +7,8 @@ using AscNet.Table.V2.share.character.grade;
using MessagePack;
using AscNet.Common;
using AscNet.Table.V2.share.character.quality;
+using MongoDB.Driver.Linq;
+using AscNet.Table.V2.share.character.skill;
namespace AscNet.GameServer.Handlers
{
@@ -25,6 +27,18 @@ namespace AscNet.GameServer.Handlers
public int Code;
}
+ [MessagePackObject(true)]
+ public class CharacterUnlockSkillGroupRequest
+ {
+ public int SkillGroupId;
+ }
+
+ [MessagePackObject(true)]
+ public class CharacterUnlockSkillGroupResponse
+ {
+ public int Code;
+ }
+
[MessagePackObject(true)]
public class CharacterPromoteQualityRequest
{
@@ -268,6 +282,23 @@ namespace AscNet.GameServer.Handlers
session.SendResponse(new CharacterPromoteQualityResponse(), packet.Id);
}
+ [RequestPacketHandler("CharacterUnlockSkillGroupRequest")]
+ public static void CharacterUnlockSkillGroupRequestHandler(Session session, Packet.Request packet)
+ {
+ CharacterUnlockSkillGroupRequest request = packet.Deserialize();
+
+ NotifyCharacterDataList notifyCharacterData = new();
+ var affectedChars = TableReaderV2.Parse().Where(x => x.SkillGroupId.Contains(request.SkillGroupId)).Select(x => x.CharacterId);
+ foreach (var character in session.character.Characters.Where(x => affectedChars.Any(y => y == x.Id)))
+ {
+ character.SkillList.AddRange(TableReaderV2.Parse().Where(x => x.Id == request.SkillGroupId).SelectMany(x => x.SkillId).Select(x => new NotifyCharacterDataList.CharacterData.CharacterSkill() { Id = (uint)x, Level = 1 }));
+ notifyCharacterData.CharacterDataList.Add(character);
+ }
+ session.SendPush(notifyCharacterData);
+
+ session.SendResponse(new CharacterUpgradeSkillGroupResponse(), packet.Id);
+ }
+
[RequestPacketHandler("CharacterUpgradeSkillGroupRequest")]
public static void CharacterUpgradeSkillGroupRequestHandler(Session session, Packet.Request packet)
{