From 855fc2c9bb87a2738a33a32f83908109ef1b6210 Mon Sep 17 00:00:00 2001 From: moux23333 <110985481+moux23333@users.noreply.github.com> Date: Wed, 31 Jan 2024 12:30:01 +0800 Subject: [PATCH] all avatars and team character changing --- .../Manager/Handlers/AvatarReqGroup.cs | 10 +- .../Manager/Handlers/LineupReqGroup.cs | 94 ++++++++++++++++++- .../Manager/Handlers/PlayerReqGroup.cs | 12 --- .../Network/Factory/ProtoFactory.cs | 11 ++- 4 files changed, 109 insertions(+), 18 deletions(-) diff --git a/FreeSR.Gateserver/Manager/Handlers/AvatarReqGroup.cs b/FreeSR.Gateserver/Manager/Handlers/AvatarReqGroup.cs index 8230cad..d2d238f 100644 --- a/FreeSR.Gateserver/Manager/Handlers/AvatarReqGroup.cs +++ b/FreeSR.Gateserver/Manager/Handlers/AvatarReqGroup.cs @@ -17,7 +17,11 @@ IsAll = request.IsGetAll }; - uint[] characters = new uint[] { 8001, 1307, 1306, 1312 }; + uint[] characters = new uint[] { 8001,8002,8003,8004, + 1001,1002,1003,1004,1005,1006,1008,1009,1013, + 1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112, + 1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1217, + 1302,1303,1305,1306,1307,1312}; foreach (uint id in characters) { @@ -25,8 +29,8 @@ { BaseAvatarId = id, Exp = 0, - Level = 1, - Promotion = 0, + Level = 80, + Promotion = 6, Rank = 6, EquipmentUniqueId = 0 }; diff --git a/FreeSR.Gateserver/Manager/Handlers/LineupReqGroup.cs b/FreeSR.Gateserver/Manager/Handlers/LineupReqGroup.cs index bd36f62..045d532 100644 --- a/FreeSR.Gateserver/Manager/Handlers/LineupReqGroup.cs +++ b/FreeSR.Gateserver/Manager/Handlers/LineupReqGroup.cs @@ -6,6 +6,10 @@ internal static class LineupReqGroup { + public static uint Avatar1 = 8001; + public static uint Avatar2 = 1307; + public static uint Avatar3 = 1306; + public static uint Avatar4 = 1312; [Handler(CmdType.CmdGetCurLineupDataCsReq)] public static void OnGetCurLineupDataCsReq(NetSession session, int cmdId, object _) { @@ -23,7 +27,7 @@ MaxMp = 5 }; - var characters = new uint[] { 8001, 1307, 1306, 1312 }; + var characters = new uint[] { Avatar1, Avatar2, Avatar3, Avatar4 }; foreach (uint id in characters) { @@ -59,7 +63,7 @@ LeaderSlot = 0 }); - var characters = new uint[] { 8001, 1307, 1306, 1312 }; + var characters = new uint[] { Avatar1, Avatar2, Avatar3, Avatar4 }; foreach (uint id in characters) { @@ -87,5 +91,91 @@ Retcode = (uint)RetcodeStatus.RetSucc }); } + + [Handler(CmdType.CmdJoinLineupCsReq)] + public static void OnJoinLineupCsReq(NetSession session, int cmdId, object data) + { + var request = data as JoinLineupCsReq; + if (request.Slot == 0) Avatar1 = request.BaseAvatarId; + if (request.Slot == 1) Avatar2 = request.BaseAvatarId; + if (request.Slot == 2) Avatar3 = request.BaseAvatarId; + if (request.Slot == 3) Avatar4 = request.BaseAvatarId; + RefreshLineup(session); + + session.Send(CmdType.CmdJoinLineupScRsp, new JoinLineupScRsp + { + Retcode = (uint)RetcodeStatus.RetSucc + }); + } + + [Handler(CmdType.CmdReplaceLineupCsReq)] + public static void OnReplaceLineupCsReq(NetSession session, int cmdId, object data) + { + + var request = data as ReplaceLineupCsReq; + Avatar1 = 0; Avatar2 = 0; Avatar3 = 0; Avatar4 = 0; + foreach (LineupSlotData slotData in request.LineupSlotLists) + { + Console.WriteLine($"Replace Slot:{slotData.Slot} Id:{slotData.Id}"); + if (slotData.Slot == 0) Avatar1 = slotData.Id; + if (slotData.Slot == 1) Avatar2 = slotData.Id; + if (slotData.Slot == 2) Avatar3 = slotData.Id; + if (slotData.Slot == 3) Avatar4 = slotData.Id; + } + + RefreshLineup(session); + session.Send(CmdType.CmdReplaceLineupScRsp, new ReplaceLineupScRsp + { + Retcode = (uint)RetcodeStatus.RetSucc + }); + } + + [Handler(CmdType.CmdQuitLineupCsReq)] + public static void OnQuitLineupCsReq(NetSession session, int cmdId, object data) + { + var request = data as QuitLineupCsReq; + Console.WriteLine($"CmdQuitLineupCsReq BaseAvatarId:{request.BaseAvatarId} Index:{request.Index} PlaneId:{request.PlaneId}"); + if (request.BaseAvatarId == Avatar1) Avatar1 = 0; + if (request.BaseAvatarId == Avatar2) Avatar2 = 0; + if (request.BaseAvatarId == Avatar3) Avatar3 = 0; + if (request.BaseAvatarId == Avatar4) Avatar4 = 0; + + RefreshLineup(session); + session.Send(CmdType.CmdQuitLineupScRsp, new QuitLineupScRsp + { + Retcode = (uint)RetcodeStatus.RetSucc, + BaseAvatarId = request.BaseAvatarId, + IsVirtual = request.IsVirtual + }); + } + public static void RefreshLineup(NetSession session) { + Console.WriteLine($"Team refreshed!{Avatar1} {Avatar2} {Avatar3} {Avatar4}"); + var characters = new uint[] { Avatar1, Avatar2, Avatar3, Avatar4 }; + var response = new SyncLineupNotify + { + Lineup = new LineupInfo + { + ExtraLineupType = ExtraLineupType.LineupNone, + Name = "Squad 1", + Mp = 5, + MaxMp = 5, + LeaderSlot = 0 + } + }; + foreach (uint id in characters) + { + if (id == 0) continue; + response.Lineup.AvatarLists.Add(new LineupAvatar + { + AvatarType = AvatarType.AvatarFormalType, + Sp = new AmountInfo { CurAmount = 10000, MaxAmount = 10000 }, + Hp = 10000, + Satiety = 100, + Id = id, + Slot = (uint)response.Lineup.AvatarLists.Count + }); + } + session.Send(CmdType.CmdSyncLineupNotify, response); + } } } diff --git a/FreeSR.Gateserver/Manager/Handlers/PlayerReqGroup.cs b/FreeSR.Gateserver/Manager/Handlers/PlayerReqGroup.cs index f282a2d..7da9e7c 100644 --- a/FreeSR.Gateserver/Manager/Handlers/PlayerReqGroup.cs +++ b/FreeSR.Gateserver/Manager/Handlers/PlayerReqGroup.cs @@ -107,18 +107,6 @@ ServerAnnounceNotify announceNotify = JsonConvert.DeserializeObject(decodedJsonData); session.Send(10, announceNotify); - /*session.Send(10, new ServerAnnounceNotify - { - Opgimnkoknjs = - { - new AnnounceData - { - BeginTime = 0, - EndTime = DateTimeOffset.Now.ToUnixTimeSeconds() + 10, - Jhjbgmmpccj = @"FreeSR is a free and open-source software, if you paid for this, you have been scammed! FreeSR是一个免费且开源的软件,如果你是花钱买来的,说明你被骗了!repository link 仓库地址:https://git.xeondev.com/Moux23333/FreeSR" - } - } - });*/ } } } diff --git a/FreeSR.Gateserver/Network/Factory/ProtoFactory.cs b/FreeSR.Gateserver/Network/Factory/ProtoFactory.cs index b499a31..aa0e607 100644 --- a/FreeSR.Gateserver/Network/Factory/ProtoFactory.cs +++ b/FreeSR.Gateserver/Network/Factory/ProtoFactory.cs @@ -36,7 +36,16 @@ {CmdType.CmdGetNpcTakenRewardCsReq, typeof(Eddbhmdjadb)}, {CmdType.CmdGetFirstTalkByPerformanceNpcCsReq, typeof(Jknjlicadhe)}, - //{CmdType.CmdGetBagCsReq, typeof(GetBagCsReq)} + {CmdType.CmdSceneEntityMoveCsReq, typeof(SceneEntityMoveCsReq)}, + {CmdType.CmdReplaceLineupCsReq, typeof(ReplaceLineupCsReq)}, + + {CmdType.CmdJoinLineupCsReq, typeof(JoinLineupCsReq)}, + {CmdType.CmdQuitLineupCsReq, typeof(QuitLineupCsReq)}, + {CmdType.CmdSwapLineupCsReq, typeof(SwapLineupCsReq)}, + + {CmdType.CmdSetLineupNameCsReq, typeof(SetLineupNameCsReq)}, + {CmdType.CmdStartCocoonStageCsReq, typeof(StartCocoonStageCsReq)}, + {CmdType.CmdPVEBattleResultCsReq, typeof(PVEBattleResultCsReq)} }); s_types = builder.ToImmutable();