diff --git a/Command/Command/Cmd/CommandGrid.cs b/Command/Command/Cmd/CommandGrid.cs index 6de88b87..f3087650 100644 --- a/Command/Command/Cmd/CommandGrid.cs +++ b/Command/Command/Cmd/CommandGrid.cs @@ -39,7 +39,7 @@ public class CommandGrid : ICommand return; } - await inst.GetComponent().AddAvatar(roleId, tier); + await inst.GetComponent().AddAvatar(roleId, tier); await arg.SendMsg(I18NManager.Translate("Game.Command.Grid.AddedRole")); } diff --git a/GameServer/Game/Battle/BattleInstance.cs b/GameServer/Game/Battle/BattleInstance.cs index 5ad0e1d8..8fff7a08 100644 --- a/GameServer/Game/Battle/BattleInstance.cs +++ b/GameServer/Game/Battle/BattleInstance.cs @@ -71,6 +71,16 @@ public class BattleInstance(PlayerInstance player, LineupInfo lineup, List(); + public GridFightRoleComponent AvatarComponent { get; set; } = inst.GetComponent(); public GridFightBasicComponent BasicComponent { get; set; } = inst.GetComponent(); public GridFightGameSectionInfo CurSection { get; set; } = curSection; public PlayerInstance Player { get; set; } = player; public void HandleProto(SceneBattleInfo proto, BattleInstance battle) { - var avatars = AvatarComponent.GetForegroundAvatarInfos(); + var avatars = AvatarComponent.GetForegroundAvatarInfos(4 + BasicComponent.GetFieldCount()); + + var tempLineup = new LineupInfo + { + BaseAvatars = avatars.Select(y => new LineupAvatarInfo + { + BaseAvatarId = y.BaseAvatarId + }).ToList() + }; var formatted = avatars.Select(x => x.ToBattleProto( - new PlayerDataCollection(Player.Data, Player.InventoryManager!.Data, - Player.LineupManager!.GetCurLineup()!), AvatarType.AvatarGridFightType)).ToList(); + new PlayerDataCollection(Player.Data, Player.InventoryManager!.Data, tempLineup), AvatarType.AvatarGridFightType)).ToList(); - proto.BattleAvatarList.Add(formatted); + proto.BattleAvatarList.Add(formatted.Take(4)); foreach (var wave in Encounter.MonsterWaves) { @@ -58,7 +67,7 @@ public class BattleGridFightOptions(GridFightGameSectionInfo curSection, GridFig { GridGameAvatarList = { - AvatarComponent.Data.Roles.Where(x => x.Pos <= 4).Select(x => x.ToBattleInfo()) + AvatarComponent.Data.Roles.Where(x => x.Pos <= 4 + BasicComponent.GetFieldCount()).Select(x => x.ToBattleInfo()) }, BattleWaveId = 1, GridFightCurLevel = BasicComponent.Data.CurLevel, diff --git a/GameServer/Game/GridFight/Component/GridFightBasicComponent.cs b/GameServer/Game/GridFight/Component/GridFightBasicComponent.cs index 854c761c..de089c79 100644 --- a/GameServer/Game/GridFight/Component/GridFightBasicComponent.cs +++ b/GameServer/Game/GridFight/Component/GridFightBasicComponent.cs @@ -8,6 +8,8 @@ namespace EggLink.DanhengServer.GameServer.Game.GridFight.Component; public class GridFightBasicComponent(GridFightInstance inst) : BaseGridFightComponent(inst) { + public const uint MaxHp = 100; + public GridFightBasicInfoPb Data { get; set; } = new() { CurHp = 100, @@ -34,6 +36,18 @@ public class GridFightBasicComponent(GridFightInstance inst) : BaseGridFightComp return Retcode.RetSucc; } + public async ValueTask UpdateLineupHp(int changeNum, bool sendPacket = true, GridFightSrc src = GridFightSrc.KGridFightSrcBattleEnd) + { + Data.CurHp = (uint)Math.Min(Math.Max(Data.CurHp + changeNum, 0), MaxHp); + + if (sendPacket) + { + await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(new GridFightLineupHpSyncData(src, Data))); + } + + return Retcode.RetSucc; + } + public async ValueTask BuyLevelExp(bool sendPacket = true) { if (!GameData.GridFightPlayerLevelData.TryGetValue(Data.CurLevel, out var levelConf) || levelConf.LevelUpExp == 0) @@ -43,12 +57,35 @@ public class GridFightBasicComponent(GridFightInstance inst) : BaseGridFightComp if (await UpdateGoldNum((int)-Data.BuyLevelCost, false) != Retcode.RetSucc) return Retcode.RetGridFightCoinNotEnough; - Data.LevelExp += 1; + return await AddLevelExp(1, sendPacket); + } + + public async ValueTask AddLevelExp(uint exp, bool sendPacket = true) + { + var upperLevels = GameData.GridFightPlayerLevelData.Values.Where(x => x.PlayerLevel >= Data.CurLevel) + .OrderBy(x => x.PlayerLevel).ToList(); + + if (upperLevels.Count == 1) // 1 contain cur level + return Retcode.RetGridFightGameplayLevelMax; // already max level + + Data.LevelExp += exp; // LEVEL UP - if (Data.LevelExp >= levelConf.LevelUpExp) + var costExp = 0; + var targetLevel = Data.CurLevel; + + foreach (var level in upperLevels) { - await UpgradeLevel(1, false); + if (level.LevelUpExp + costExp > Data.LevelExp) + break; + + costExp += (int)level.LevelUpExp; + targetLevel = level.PlayerLevel + 1; + } + + if (targetLevel > Data.CurLevel) + { + await UpgradeLevel(targetLevel - Data.CurLevel, false); } if (sendPacket) @@ -68,8 +105,17 @@ public class GridFightBasicComponent(GridFightInstance inst) : BaseGridFightComp if (!GameData.GridFightPlayerLevelData.TryGetValue(level + Data.CurLevel, out var levelConf)) return Retcode.RetGridFightGameplayLevelMax; + // adjust exp and other stats + for (var i = Data.CurLevel; i < level + Data.CurLevel; i++) + { + if (!GameData.GridFightPlayerLevelData.TryGetValue(i, out var curLevelConf)) + break; + + Data.LevelExp -= curLevelConf.LevelUpExp; + } + Data.CurLevel += level; - Data.LevelExp = 0; + Data.BuyLevelCost = (uint)Math.Ceiling(Data.CurLevel / 2f); Data.CurOnGroundAvatarCount = levelConf.AvatarMaxNumber; @@ -105,6 +151,7 @@ public class GridFightBasicComponent(GridFightInstance inst) : BaseGridFightComp GridFightLineupHp = Data.CurHp, GridFightCurGold = Data.CurGold, GridFightMaxGold = 2000, + GridFightComboWinNum = Data.ComboNum, OCMGMEHECBB = new OPIBBPCHFII { IJDIAOMINLB = new BHJALAPDBLH() diff --git a/GameServer/Game/GridFight/Component/GridFightLevelComponent.cs b/GameServer/Game/GridFight/Component/GridFightLevelComponent.cs index bb254c3a..5d7f7cf3 100644 --- a/GameServer/Game/GridFight/Component/GridFightLevelComponent.cs +++ b/GameServer/Game/GridFight/Component/GridFightLevelComponent.cs @@ -14,6 +14,7 @@ public class GridFightLevelComponent : BaseGridFightComponent private uint _curSectionId = 1; public Dictionary> Sections { get; } = []; public GridFightGameSectionInfo CurrentSection => Sections[_curChapterId][(int)(_curSectionId - 1)]; + public List RoleDamageSttInfos { get; } = []; public GridFightLevelComponent(GridFightInstance inst) : base(inst) { @@ -38,6 +39,51 @@ public class GridFightLevelComponent : BaseGridFightComponent } } + public async ValueTask<(Retcode, GridFightRoleDamageSttInfo?)> AddRoleDamageStt(uint roleId, double damage, bool sendPacket = true) + { + var roleComp = Inst.GetComponent(); + + var role = roleComp.Data.Roles.OrderBy(x => x.Pos).FirstOrDefault(x => x.RoleId == roleId); + if (role == null) + return (Retcode.RetGridFightRoleNotExist, null); + + var info = RoleDamageSttInfos.FirstOrDefault(x => x.RoleId == roleId && x.Tier == role.Tier); + GridFightRoleDamageSttInfo res; + if (info == null) + { + res = info = new GridFightRoleDamageSttInfo + { + RoleId = roleId, + Tier = role.Tier, + TotalDamage = damage, + IsTrialAvatar = false, + IsUpgrade = false + }; + + RoleDamageSttInfos.Add(info); + } + else + { + res = new GridFightRoleDamageSttInfo + { + RoleId = info.RoleId, + IsTrialAvatar = info.IsTrialAvatar, + IsUpgrade = info.IsUpgrade, + Tier = info.Tier, + TotalDamage = damage + }; + + info.TotalDamage += damage; + } + + if (sendPacket) + { + await Inst.Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(new GridFightRoleDamageSttSyncData(GridFightSrc.KGridFightSrcBattleEnd, this))); + } + + return (Retcode.RetSucc, res); + } + public async ValueTask> EnterNextSection(bool sendPacket = true) { // if last section of chapter @@ -123,10 +169,40 @@ public class GridFightLevelComponent : BaseGridFightComponent }, LevelSttInfo = new GridFightLevelSttInfo { + GridFightDamageSttInfo = ToDamageSttInfo() } } }; } + + public GridFightDamageSttInfo ToDamageSttInfo() + { + return new GridFightDamageSttInfo + { + RoleDamageSttList = { RoleDamageSttInfos.Select(x => x.ToProto()) } + }; + } +} + +public class GridFightRoleDamageSttInfo +{ + public uint RoleId { get; set; } + public uint Tier { get; set; } + public double TotalDamage { get; set; } + public bool IsTrialAvatar { get; set; } + public bool IsUpgrade { get; set; } + + public GridFightRoleDamageStt ToProto() + { + return new GridFightRoleDamageStt + { + RoleBasicId = RoleId, + Tier = Tier, + IsTrialAvatar = IsTrialAvatar, + IsUpgrade = IsUpgrade, + TotalDamage = TotalDamage + }; + } } public class GridFightGameSectionInfo diff --git a/GameServer/Game/GridFight/Component/GridFightAvatarComponent.cs b/GameServer/Game/GridFight/Component/GridFightRoleComponent.cs similarity index 94% rename from GameServer/Game/GridFight/Component/GridFightAvatarComponent.cs rename to GameServer/Game/GridFight/Component/GridFightRoleComponent.cs index 3ca38064..c39428ec 100644 --- a/GameServer/Game/GridFight/Component/GridFightAvatarComponent.cs +++ b/GameServer/Game/GridFight/Component/GridFightRoleComponent.cs @@ -7,7 +7,7 @@ using EggLink.DanhengServer.Proto.ServerSide; namespace EggLink.DanhengServer.GameServer.Game.GridFight.Component; -public class GridFightAvatarComponent(GridFightInstance inst) : BaseGridFightComponent(inst) +public class GridFightRoleComponent(GridFightInstance inst) : BaseGridFightComponent(inst) { public GridFightAvatarInfoPb Data { get; set; } = new(); @@ -75,9 +75,9 @@ public class GridFightAvatarComponent(GridFightInstance inst) : BaseGridFightCom return syncs; } - public List GetForegroundAvatarInfos() + public List GetForegroundAvatarInfos(uint maxAvatarNum) { - var foreground = Data.Roles.Where(x => x.Pos <= 4).ToList(); + var foreground = Data.Roles.Where(x => x.Pos <= maxAvatarNum).OrderBy(x => x.Pos).ToList(); List res = []; foreach (var role in foreground) diff --git a/GameServer/Game/GridFight/Component/GridFightShopComponent.cs b/GameServer/Game/GridFight/Component/GridFightShopComponent.cs index f7e609a6..24be089f 100644 --- a/GameServer/Game/GridFight/Component/GridFightShopComponent.cs +++ b/GameServer/Game/GridFight/Component/GridFightShopComponent.cs @@ -52,7 +52,7 @@ public class GridFightShopComponent(GridFightInstance inst) : BaseGridFightCompo // GIVE ITEMS List syncs = []; - var avatarComp = Inst.GetComponent(); + var avatarComp = Inst.GetComponent(); foreach (var item in targetGoods) { if (item.ItemTypeCase == GridFightShopItemPb.ItemTypeOneofCase.RoleItem) @@ -69,6 +69,9 @@ public class GridFightShopComponent(GridFightInstance inst) : BaseGridFightCompo foreach (var index in indexes) { Data.ShopItems.RemoveAt((int)index); + + // add new item + AddGoods(1, curLevel); } if (sendPacket) @@ -82,6 +85,47 @@ public class GridFightShopComponent(GridFightInstance inst) : BaseGridFightCompo return Retcode.RetSucc; } + public void AddGoods(uint num, uint curLevel) + { + var rules = GameData.GridFightPlayerLevelData.GetValueOrDefault(curLevel)?.RarityWeights ?? + [100, 0, 0, 0, 0]; + List usedIds = Data.ShopItems.Select(x => x.RoleItem.RoleId).ToList(); + // generate items + for (var i = 0; i < num; i++) + { + // select rarity + var rand = (uint)Random.Shared.Next(1, 101); + var targetRarity = 0; + for (var j = 0; j < 5; j++) + { + if (rand <= rules[j]) + { + targetRarity = j + 1; + break; + } + rand -= rules[j]; + } + + // get item pool + var pool = GameData.GridFightRoleBasicInfoData.Values + .Where(x => !usedIds.Contains(x.ID) && x.IsInPool && x.Rarity == targetRarity).ToList(); + + var target = pool.RandomElement(); + usedIds.Add(target.ID); + + var tier = 1u; + Data.ShopItems.Add(new GridFightShopItemPb + { + Rarity = target.Rarity, + RoleItem = new GridFightShopRoleItemPb + { + RoleId = target.ID, + Tier = tier + } + }); + } + } + public async ValueTask RefreshShop(bool isEnterSection, bool sendPacket = true) { if (!isEnterSection) @@ -113,46 +157,9 @@ public class GridFightShopComponent(GridFightInstance inst) : BaseGridFightCompo // refresh var curLevel = Inst.GetComponent().Data.CurLevel; - var rules = GameData.GridFightPlayerLevelData.GetValueOrDefault(curLevel)?.RarityWeights ?? - [100, 0, 0, 0, 0]; - Data.ShopItems.Clear(); - List usedIds = []; - // generate items - for (var i = 0; i < 5; i++) - { - // select rarity - var rand = (uint)Random.Shared.Next(1, 101); - var targetRarity = 0; - for (var j = 0; j < 5; j++) - { - if (rand <= rules[j]) - { - targetRarity = j + 1; - break; - } - rand -= rules[j]; - } - - // get item pool - var pool = GameData.GridFightRoleBasicInfoData.Values - .Where(x => !usedIds.Contains(x.ID) && x.IsInPool && x.Rarity == targetRarity).ToList(); - - var target = pool.RandomElement(); - usedIds.Add(target.ID); - - var tier = 1u; - Data.ShopItems.Add(new GridFightShopItemPb - { - Rarity = target.Rarity, - RoleItem = new GridFightShopRoleItemPb - { - RoleId = target.ID, - Tier = tier - } - }); - } + AddGoods(5, curLevel); if (sendPacket) { diff --git a/GameServer/Game/GridFight/GridFightInstance.cs b/GameServer/Game/GridFight/GridFightInstance.cs index 6b75d2a2..87944093 100644 --- a/GameServer/Game/GridFight/GridFightInstance.cs +++ b/GameServer/Game/GridFight/GridFightInstance.cs @@ -21,19 +21,63 @@ public class GridFightInstance(PlayerInstance player, uint season, uint division return Player.BattleManager!.StartGridFightBattle(this); } - public async ValueTask EndBattle(BattleInstance battle) + public async ValueTask EndBattle(BattleInstance battle, PVEBattleResultCsReq req) { - if (battle.BattleEndStatus != BattleEndStatus.BattleEndWin) return; + if (battle.BattleEndStatus == BattleEndStatus.BattleEndQuit) return; List syncs = []; - await Player.SendPacket(new PacketGridFightEndBattleStageNotify(this)); - var basicComp = GetComponent(); - await basicComp.UpdateGoldNum(5, false, GridFightSrc.KGridFightSrcNone); + var levelComp = GetComponent(); + var prevData = basicComp.Data.Clone(); + + var expNum = 5u; + var baseCoin = 3u; + var interestCoin = basicComp.Data.CurGold / 10; + + if (battle.BattleEndStatus == BattleEndStatus.BattleEndWin) + { + basicComp.Data.ComboNum++; + } + else + { + basicComp.Data.ComboNum = 0; + + // cost hp + await basicComp.UpdateLineupHp(-5, false); + } + + var comboCoin = basicComp.Data.ComboNum switch + { + >= 5 => 3u, + 2 or 3 or 4 => 2u, + 0 => 0u, + _ => 1u + }; + + await basicComp.UpdateGoldNum((int)(baseCoin + interestCoin + comboCoin), false, GridFightSrc.KGridFightSrcNone); + await basicComp.AddLevelExp(expNum, false); + + List sttList = []; + foreach (var roleBattleStt in req.Stt.GridFightBattleStt.RoleBattleStt) + { + var res = await levelComp.AddRoleDamageStt(roleBattleStt.RoleBasicId, roleBattleStt.Damage, false); + if (res.Item2 != null) + sttList.Add(res.Item2); + } + + var curData = basicComp.Data.Clone(); + await Player.SendPacket(new PacketGridFightEndBattleStageNotify(this, expNum, prevData, curData, + sttList, battle.BattleEndStatus == BattleEndStatus.BattleEndWin, baseCoin, interestCoin, + comboCoin)); + syncs.Add(new GridFightGoldSyncData(GridFightSrc.KGridFightSrcBattleEnd, basicComp.Data)); - syncs.AddRange(await GetComponent().EnterNextSection(false)); + syncs.Add(new GridFightPlayerLevelSyncData(GridFightSrc.KGridFightSrcBattleEnd, basicComp.Data)); + syncs.Add(new GridFightLineupHpSyncData(GridFightSrc.KGridFightSrcBattleEnd, basicComp.Data)); + syncs.Add(new GridFightComboNumSyncData(GridFightSrc.KGridFightSrcBattleEnd, basicComp.Data)); + syncs.Add(new GridFightRoleDamageSttSyncData(GridFightSrc.KGridFightSrcBattleEnd, levelComp)); + syncs.AddRange(await levelComp.EnterNextSection(false)); await Player.SendPacket(new PacketGridFightSyncUpdateResultScNotify(syncs)); } @@ -43,9 +87,9 @@ public class GridFightInstance(PlayerInstance player, uint season, uint division Components.Add(new GridFightBasicComponent(this)); Components.Add(new GridFightShopComponent(this)); Components.Add(new GridFightLevelComponent(this)); - Components.Add(new GridFightAvatarComponent(this)); + Components.Add(new GridFightRoleComponent(this)); - _ = GetComponent().AddAvatar(1414, 3, false); // TODO test + _ = GetComponent().AddAvatar(1414, 3, false); // TODO test _ = GetComponent().RefreshShop(true, false); } diff --git a/GameServer/Game/GridFight/Sync/GridFightComboNumSyncData.cs b/GameServer/Game/GridFight/Sync/GridFightComboNumSyncData.cs new file mode 100644 index 00000000..f23d830c --- /dev/null +++ b/GameServer/Game/GridFight/Sync/GridFightComboNumSyncData.cs @@ -0,0 +1,15 @@ +using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Proto.ServerSide; + +namespace EggLink.DanhengServer.GameServer.Game.GridFight.Sync; + +public class GridFightComboNumSyncData(GridFightSrc src, GridFightBasicInfoPb info) : BaseGridFightSyncData(src) +{ + public override GridFightSyncData ToProto() + { + return new GridFightSyncData + { + GridFightComboWinNum = info.ComboNum + }; + } +} \ No newline at end of file diff --git a/GameServer/Game/GridFight/Sync/GridFightLineupHpSyncData.cs b/GameServer/Game/GridFight/Sync/GridFightLineupHpSyncData.cs new file mode 100644 index 00000000..50557a6a --- /dev/null +++ b/GameServer/Game/GridFight/Sync/GridFightLineupHpSyncData.cs @@ -0,0 +1,18 @@ +using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Proto.ServerSide; + +namespace EggLink.DanhengServer.GameServer.Game.GridFight.Sync; + +public class GridFightLineupHpSyncData(GridFightSrc src, GridFightBasicInfoPb info) : BaseGridFightSyncData(src) +{ + public override GridFightSyncData ToProto() + { + return new GridFightSyncData + { + GridFightLineupHp = new GridFightLineupHpSyncInfo + { + GridFightLineupHp = info.CurHp + } + }; + } +} \ No newline at end of file diff --git a/GameServer/Game/GridFight/Sync/GridFightRoleDamageSttSyncData.cs b/GameServer/Game/GridFight/Sync/GridFightRoleDamageSttSyncData.cs new file mode 100644 index 00000000..1ad89554 --- /dev/null +++ b/GameServer/Game/GridFight/Sync/GridFightRoleDamageSttSyncData.cs @@ -0,0 +1,15 @@ +using EggLink.DanhengServer.GameServer.Game.GridFight.Component; +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.GameServer.Game.GridFight.Sync; + +public class GridFightRoleDamageSttSyncData(GridFightSrc src, GridFightLevelComponent comp) : BaseGridFightSyncData(src) +{ + public override GridFightSyncData ToProto() + { + return new GridFightSyncData + { + GridFightDamageSttInfo = comp.ToDamageSttInfo() + }; + } +} \ No newline at end of file diff --git a/GameServer/Server/Packet/Recv/GridFight/HandlerGridFightRecycleRoleCsReq.cs b/GameServer/Server/Packet/Recv/GridFight/HandlerGridFightRecycleRoleCsReq.cs index 25b6fc5e..7be3f9de 100644 --- a/GameServer/Server/Packet/Recv/GridFight/HandlerGridFightRecycleRoleCsReq.cs +++ b/GameServer/Server/Packet/Recv/GridFight/HandlerGridFightRecycleRoleCsReq.cs @@ -18,7 +18,7 @@ public class HandlerGridFightRecycleRoleCsReq : Handler return; } - var roleComp = gridFight.GetComponent(); + var roleComp = gridFight.GetComponent(); await roleComp.SellAvatar(req.UniqueId); await connection.SendPacket(CmdIds.GridFightRecycleRoleScRsp); diff --git a/GameServer/Server/Packet/Recv/GridFight/HandlerGridFightUpdatePosCsReq.cs b/GameServer/Server/Packet/Recv/GridFight/HandlerGridFightUpdatePosCsReq.cs index 32d2e656..ab74adeb 100644 --- a/GameServer/Server/Packet/Recv/GridFight/HandlerGridFightUpdatePosCsReq.cs +++ b/GameServer/Server/Packet/Recv/GridFight/HandlerGridFightUpdatePosCsReq.cs @@ -20,7 +20,7 @@ public class HandlerGridFightUpdatePosCsReq : Handler } var gridFight = connection.Player.GridFightManager.GridFightInstance; - await gridFight.GetComponent().UpdatePos(req.GridFightPosInfoList.ToList()); + await gridFight.GetComponent().UpdatePos(req.GridFightPosInfoList.ToList()); await connection.SendPacket( new PacketGridFightUpdatePosScRsp(Retcode.RetSucc, req.GridFightPosInfoList)); diff --git a/GameServer/Server/Packet/Send/GridFight/PacketGridFightEndBattleStageNotify.cs b/GameServer/Server/Packet/Send/GridFight/PacketGridFightEndBattleStageNotify.cs index aa6f2046..89a362cc 100644 --- a/GameServer/Server/Packet/Send/GridFight/PacketGridFightEndBattleStageNotify.cs +++ b/GameServer/Server/Packet/Send/GridFight/PacketGridFightEndBattleStageNotify.cs @@ -1,13 +1,17 @@ +using EggLink.DanhengServer.Data; using EggLink.DanhengServer.GameServer.Game.GridFight; using EggLink.DanhengServer.GameServer.Game.GridFight.Component; using EggLink.DanhengServer.Kcp; using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Proto.ServerSide; namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.GridFight; public class PacketGridFightEndBattleStageNotify : BasePacket { - public PacketGridFightEndBattleStageNotify(GridFightInstance inst) : base(CmdIds.GridFightEndBattleStageNotify) + public PacketGridFightEndBattleStageNotify(GridFightInstance inst, uint expAddNum, GridFightBasicInfoPb prev, + GridFightBasicInfoPb cur, List stt, bool win, uint baseCoin, uint interestCoin, + uint comboCoin) : base(CmdIds.GridFightEndBattleStageNotify) { var levelComp = inst.GetComponent(); var curSec = levelComp.CurrentSection; @@ -17,12 +21,34 @@ public class PacketGridFightEndBattleStageNotify : BasePacket SectionId = curSec.SectionId, RouteId = curSec.Excel.ID, ChapterId = curSec.ChapterId, - GridFightDamageSttInfo = new GridFightDamageSttInfo(), - EMLLKALLOPL = new HEHHADKPDOC + GridFightDamageSttInfo = new GridFightDamageSttInfo { - CGECGAAJLJM = new(), - NMMJMPNGIGD = new() - } + RoleDamageSttList = { stt.Select(x => x.ToProto()) } + }, + GridFightLevelUpdateInfo = new GridFightLevelUpdateInfo + { + PrevLevelInfo = new GridFightLevelDisplayInfo + { + Level = prev.CurLevel, + MaxExp = GameData.GridFightPlayerLevelData[prev.CurLevel].LevelUpExp, + Exp = prev.LevelExp + }, + CurLevelInfo = new GridFightLevelDisplayInfo + { + Level = cur.CurLevel, + MaxExp = GameData.GridFightPlayerLevelData[cur.CurLevel].LevelUpExp, + Exp = cur.LevelExp + }, + AddExpNum = expAddNum + }, + AddExpNum = expAddNum, + GridFightCurComboNum = cur.ComboNum, + GridFightChallengeWin = win, + GridFightCoinBaseNum = baseCoin, + GridFightCoinInterestNum = interestCoin, + GridFightCoinComboNum = comboCoin, + GridFightCurLineupHp = cur.CurHp, + GridFightMaxLineupHp = GridFightBasicComponent.MaxHp }; SetData(proto); diff --git a/ServerSideProto/GridFightData.cs b/ServerSideProto/GridFightData.cs index b24624ea..3804a7e2 100644 --- a/ServerSideProto/GridFightData.cs +++ b/ServerSideProto/GridFightData.cs @@ -33,19 +33,20 @@ namespace EggLink.DanhengServer.Proto.ServerSide { "U2hvcEl0ZW1zGAQgAygLMhQuR3JpZEZpZ2h0U2hvcEl0ZW1QYiKKAQoTR3Jp", "ZEZpZ2h0R2FtZUluZm9QYhIQCghVbmlxdWVJZBgBIAEoDRISCgpEaXZpc2lv", "bklkGAIgASgNEhIKCklzT3ZlckxvY2sYAyABKAgSDgoGU2Vhc29uGAQgASgN", - "EikKCkNvbXBvbmVudHMYBSADKAsyFS5HcmlkRmlnaHRDb21wb25lbnRQYiKQ", + "EikKCkNvbXBvbmVudHMYBSADKAsyFS5HcmlkRmlnaHRDb21wb25lbnRQYiKi", "AQoUR3JpZEZpZ2h0QmFzaWNJbmZvUGISDwoHQ3VyR29sZBgBIAEoDRIQCghD", "dXJMZXZlbBgCIAEoDRIQCghMZXZlbEV4cBgDIAEoDRIUCgxCdXlMZXZlbENv", "c3QYBCABKA0SDQoFQ3VySHAYBSABKA0SHgoWQ3VyT25Hcm91bmRBdmF0YXJD", - "b3VudBgGIAEoDSJSChNHcmlkRmlnaHRSb2xlSW5mb1BiEg4KBlJvbGVJZBgB", - "IAEoDRIMCgRUaWVyGAIgASgNEgsKA1BvcxgDIAEoDRIQCghVbmlxdWVJZBgE", - "IAEoDSJRChVHcmlkRmlnaHRBdmF0YXJJbmZvUGISIwoFUm9sZXMYASADKAsy", - "FC5HcmlkRmlnaHRSb2xlSW5mb1BiEhMKC0N1clVuaXF1ZUlkGAIgASgNIqsB", - "ChRHcmlkRmlnaHRDb21wb25lbnRQYhIoCghTaG9wSW5mbxgBIAEoCzIULkdy", - "aWRGaWdodFNob3BJbmZvUGJIABIqCglCYXNpY0luZm8YAiABKAsyFS5Hcmlk", - "RmlnaHRCYXNpY0luZm9QYkgAEiwKCkF2YXRhckluZm8YAyABKAsyFi5Hcmlk", - "RmlnaHRBdmF0YXJJbmZvUGJIAEIPCg1Db21wb25lbnRUeXBlQimqAiZFZ2dM", - "aW5rLkRhbmhlbmdTZXJ2ZXIuUHJvdG8uU2VydmVyU2lkZWIGcHJvdG8z")); + "b3VudBgGIAEoDRIQCghDb21ib051bRgHIAEoDSJSChNHcmlkRmlnaHRSb2xl", + "SW5mb1BiEg4KBlJvbGVJZBgBIAEoDRIMCgRUaWVyGAIgASgNEgsKA1BvcxgD", + "IAEoDRIQCghVbmlxdWVJZBgEIAEoDSJRChVHcmlkRmlnaHRBdmF0YXJJbmZv", + "UGISIwoFUm9sZXMYASADKAsyFC5HcmlkRmlnaHRSb2xlSW5mb1BiEhMKC0N1", + "clVuaXF1ZUlkGAIgASgNIqsBChRHcmlkRmlnaHRDb21wb25lbnRQYhIoCghT", + "aG9wSW5mbxgBIAEoCzIULkdyaWRGaWdodFNob3BJbmZvUGJIABIqCglCYXNp", + "Y0luZm8YAiABKAsyFS5HcmlkRmlnaHRCYXNpY0luZm9QYkgAEiwKCkF2YXRh", + "ckluZm8YAyABKAsyFi5HcmlkRmlnaHRBdmF0YXJJbmZvUGJIAEIPCg1Db21w", + "b25lbnRUeXBlQimqAiZFZ2dMaW5rLkRhbmhlbmdTZXJ2ZXIuUHJvdG8uU2Vy", + "dmVyU2lkZWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { @@ -53,7 +54,7 @@ namespace EggLink.DanhengServer.Proto.ServerSide { new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightShopItemPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightShopItemPb.Parser, new[]{ "RoleItem", "Rarity" }, new[]{ "ItemType" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightShopInfoPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightShopInfoPb.Parser, new[]{ "ShopLocked", "FreeRefreshCount", "RefreshCost", "ShopItems" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightGameInfoPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightGameInfoPb.Parser, new[]{ "UniqueId", "DivisionId", "IsOverLock", "Season", "Components" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightBasicInfoPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightBasicInfoPb.Parser, new[]{ "CurGold", "CurLevel", "LevelExp", "BuyLevelCost", "CurHp", "CurOnGroundAvatarCount" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightBasicInfoPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightBasicInfoPb.Parser, new[]{ "CurGold", "CurLevel", "LevelExp", "BuyLevelCost", "CurHp", "CurOnGroundAvatarCount", "ComboNum" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightRoleInfoPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightRoleInfoPb.Parser, new[]{ "RoleId", "Tier", "Pos", "UniqueId" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightAvatarInfoPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightAvatarInfoPb.Parser, new[]{ "Roles", "CurUniqueId" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.ServerSide.GridFightComponentPb), global::EggLink.DanhengServer.Proto.ServerSide.GridFightComponentPb.Parser, new[]{ "ShopInfo", "BasicInfo", "AvatarInfo" }, new[]{ "ComponentType" }, null, null, null) @@ -1218,6 +1219,7 @@ namespace EggLink.DanhengServer.Proto.ServerSide { buyLevelCost_ = other.buyLevelCost_; curHp_ = other.curHp_; curOnGroundAvatarCount_ = other.curOnGroundAvatarCount_; + comboNum_ = other.comboNum_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1299,6 +1301,18 @@ namespace EggLink.DanhengServer.Proto.ServerSide { } } + /// Field number for the "ComboNum" field. + public const int ComboNumFieldNumber = 7; + private uint comboNum_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint ComboNum { + get { return comboNum_; } + set { + comboNum_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -1320,6 +1334,7 @@ namespace EggLink.DanhengServer.Proto.ServerSide { if (BuyLevelCost != other.BuyLevelCost) return false; if (CurHp != other.CurHp) return false; if (CurOnGroundAvatarCount != other.CurOnGroundAvatarCount) return false; + if (ComboNum != other.ComboNum) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1333,6 +1348,7 @@ namespace EggLink.DanhengServer.Proto.ServerSide { if (BuyLevelCost != 0) hash ^= BuyLevelCost.GetHashCode(); if (CurHp != 0) hash ^= CurHp.GetHashCode(); if (CurOnGroundAvatarCount != 0) hash ^= CurOnGroundAvatarCount.GetHashCode(); + if (ComboNum != 0) hash ^= ComboNum.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1375,6 +1391,10 @@ namespace EggLink.DanhengServer.Proto.ServerSide { output.WriteRawTag(48); output.WriteUInt32(CurOnGroundAvatarCount); } + if (ComboNum != 0) { + output.WriteRawTag(56); + output.WriteUInt32(ComboNum); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1409,6 +1429,10 @@ namespace EggLink.DanhengServer.Proto.ServerSide { output.WriteRawTag(48); output.WriteUInt32(CurOnGroundAvatarCount); } + if (ComboNum != 0) { + output.WriteRawTag(56); + output.WriteUInt32(ComboNum); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -1437,6 +1461,9 @@ namespace EggLink.DanhengServer.Proto.ServerSide { if (CurOnGroundAvatarCount != 0) { size += 1 + pb::CodedOutputStream.ComputeUInt32Size(CurOnGroundAvatarCount); } + if (ComboNum != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(ComboNum); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1467,6 +1494,9 @@ namespace EggLink.DanhengServer.Proto.ServerSide { if (other.CurOnGroundAvatarCount != 0) { CurOnGroundAvatarCount = other.CurOnGroundAvatarCount; } + if (other.ComboNum != 0) { + ComboNum = other.ComboNum; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1506,6 +1536,10 @@ namespace EggLink.DanhengServer.Proto.ServerSide { CurOnGroundAvatarCount = input.ReadUInt32(); break; } + case 56: { + ComboNum = input.ReadUInt32(); + break; + } } } #endif @@ -1545,6 +1579,10 @@ namespace EggLink.DanhengServer.Proto.ServerSide { CurOnGroundAvatarCount = input.ReadUInt32(); break; } + case 56: { + ComboNum = input.ReadUInt32(); + break; + } } } } diff --git a/ServerSideProto/ProtoFile/GridFightData.proto b/ServerSideProto/ProtoFile/GridFightData.proto index 626bebc7..630b77ff 100644 --- a/ServerSideProto/ProtoFile/GridFightData.proto +++ b/ServerSideProto/ProtoFile/GridFightData.proto @@ -36,6 +36,7 @@ message GridFightBasicInfoPb { uint32 BuyLevelCost = 4; uint32 CurHp = 5; uint32 CurOnGroundAvatarCount = 6; + uint32 ComboNum = 7; } message GridFightRoleInfoPb {