forked from PGR/ascnet
1
0
Fork 0

skill unlock + some renames

This commit is contained in:
rfi 2023-12-09 21:49:09 +07:00
parent 0fe5f84309
commit 1075d70546
3 changed files with 42 additions and 11 deletions

View File

@ -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<Table.V2.share.character.CharacterTable>().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<NotifyCharacterDataList.NotifyCharacterDataListCharacterData> Characters { get; set; }
public List<NotifyCharacterDataList.CharacterData> 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; }
}

View File

@ -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<NotifyCharacterDataListCharacterDataSkill> SkillList { get; set; } = new();
public List<CharacterSkill> SkillList { get; set; } = new();
public List<dynamic> 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<NotifyCharacterDataListCharacterData> CharacterDataList { get; set; } = new();
public List<CharacterData> CharacterDataList { get; set; } = new();
}

View File

@ -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<CharacterUnlockSkillGroupRequest>();
NotifyCharacterDataList notifyCharacterData = new();
var affectedChars = TableReaderV2.Parse<CharacterSkillTable>().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<CharacterSkillGroupTable>().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)
{