ascnet/AscNet.GameServer/Handlers/FightModule.cs

117 lines
33 KiB
C#
Raw Normal View History

2023-10-14 17:16:45 +00:00
using AscNet.Common.MsgPack;
using MessagePack;
namespace AscNet.GameServer.Handlers
{
[MessagePackObject(true)]
public class NpcHp
{
public int CharacterId { get; set; }
public int NpcId { get; set; }
public int Type { get; set; }
public int Level { get; set; }
public List<int> BuffIds { get; set; }
public dynamic AttrTable { get; set; }
}
[MessagePackObject(true)]
public class NpcDps
{
public int Value { get; set; }
public int MaxValue { get; set; }
public int RoleId { get; set; }
public int NpcId { get; set; }
public int CharacterId { get; set; }
public int DamageTotal { get; set; }
public int DamageNormal { get; set; }
public List<int> DamageMagic { get; set; }
public int BreakEndure { get; set; }
public int Cure { get; set; }
public int Hurt { get; set; }
public int Type { get; set; }
public int Level { get; set; }
public List<int> BuffIds { get; set; }
public dynamic AttrTable { get; set; }
}
[MessagePackObject(true)]
public class FightSettleResult
{
public bool IsWin { get; set; }
public bool IsForceExit { get; set; }
public int StageId { get; set; }
public int StageLevel { get; set; }
public int FightId { get; set; }
public int RebootCount { get; set; }
public int AddStars { get; set; }
public int StartFrame { get; set; }
public int SettleFrame { get; set; }
public int PauseFrame { get; set; }
public int ExSkillPauseFrame { get; set; }
public int SettleCode { get; set; }
public int DodgeTimes { get; set; }
public int NormalAttackTimes { get; set; }
public int ConsumeBallTimes { get; set; }
public int StuntSkillTimes { get; set; }
public int PauseTimes { get; set; }
public int HighestCombo { get; set; }
public int DamagedTimes { get; set; }
public int MatrixTimes { get; set; }
public int HighestDamage { get; set; }
public int TotalDamage { get; set; }
public int TotalDamaged { get; set; }
public int TotalCure { get; set; }
public List<int> PlayerIds { get; set; }
public List<PlayerData> PlayerData { get; set; }
public dynamic IntToIntRecord { get; set; }
public dynamic StringToIntRecord { get; set; }
public dynamic Operations { get; set; }
public List<int> Codes { get; set; }
public int LeftTime { get; set; }
public Dictionary<int, NpcHp> NpcHpInfo { get; set; }
public Dictionary<int, NpcDps> NpcDpsTable { get; set; }
public List<dynamic> EventSet { get; set; }
public int DeathTotalMyTeam { get; set; }
public int DeathTotalEnemy { get; set; }
public dynamic DeathRecord { get; set; }
public List<dynamic> GroupDropDatas { get; set; }
public dynamic EpisodeFightResults { get; set; }
public dynamic CustomData { get; set; }
}
[MessagePackObject(true)]
public class FightSettleRequest
{
public FightSettleResult Result { get; set; }
}
internal class FightModule
{
2023-10-14 17:34:14 +00:00
public static object JSonConvert { get; private set; }
2023-10-14 17:16:45 +00:00
[RequestPacketHandler("PreFightRequest")]
public static void PreFightRequestHandler(Session session, Packet.Request packet)
{
PreFightRequest req = MessagePackSerializer.Deserialize<PreFightRequest>(packet.Content);
2023-10-14 17:34:14 +00:00
PreFightResponse rsp = MessagePackSerializer.Deserialize<PreFightResponse>(MessagePackSerializer.ConvertFromJson($@"{{""Code"":0,""FightData"":{{""Online"":false,""FightId"":1691330911,""RoomId"":null,""OnlineMode"":0,""Seed"":631037736,""StageId"":{req.PreFightData.StageId},""RebootId"":1,""PassTimeLimit"":300,""StarsMark"":7,""MonsterLevel"":null,""EventIds"":[],""FightEventsWithLevel"":{{}},""NormalEventIds"":[1],""RoleData"":[{{""Id"":17462089,""Camp"":1,""Name"":""yarik0chka"",""IsRobot"":false,""CaptainIndex"":0,""FirstFightPos"":0,""NpcData"":{{""0"":{{""Character"":{{""Id"":1021001,""Level"":50,""Exp"":564,""Quality"":2,""InitQuality"":1,""Star"":4,""Grade"":8,""SkillList"":[{{""Id"":102101,""Level"":12}},{{""Id"":102106,""Level"":11}},{{""Id"":102111,""Level"":11}},{{""Id"":102116,""Level"":12}},{{""Id"":102117,""Level"":11}},{{""Id"":102118,""Level"":10}},{{""Id"":102121,""Level"":10}},{{""Id"":102123,""Level"":1}},{{""Id"":102122,""Level"":1}}],""EnhanceSkillList"":[],""FashionId"":6210101,""CreateTime"":1626538573,""TrustLv"":2,""TrustExp"":80,""Ability"":3387,""LiberateLv"":2,""CharacterHeadInfo"":{{""HeadFashionId"":0,""HeadFashionType"":0}}}},""Equips"":[{{""Id"":70,""TemplateId"":3035002,""CharacterId"":1021001,""Level"":45,""Exp"":60,""Breakthrough"":4,""ResonanceInfo"":[],""UnconfirmedResonanceInfo"":[],""AwakeSlotList"":[],""IsLock"":false,""CreateTime"":1626632133,""IsRecycle"":false}},{{""Id"":71,""TemplateId"":3065002,""CharacterId"":1021001,""Level"":40,""Exp"":220,""Breakthrough"":3,""ResonanceInfo"":[],""UnconfirmedResonanceInfo"":[],""AwakeSlotList"":[],""IsLock"":false,""CreateTime"":1626632133,""IsRecycle"":false}},{{""Id"":112,""TemplateId"":2025001,""CharacterId"":1021001,""Level"":45,""Exp"":160,""Breakthrough"":4,""ResonanceInfo"":[{{""Slot"":1,""Type"":1,""CharacterId"":0,""TemplateId"":20}}],""UnconfirmedResonanceInfo"":[],""AwakeSlotList"":[],""IsLock"":false,""CreateTime"":1626634841,""IsRecycle"":false}},{{""Id"":153,""TemplateId"":3025002,""CharacterId"":1021001,""Level"":45,""Exp"":10,""Breakthrough"":4,""ResonanceInfo"":[],""UnconfirmedResonanceInfo"":[],""AwakeSlotList"":[],""IsLock"":false,""CreateTime"":1626637516,""IsRecycle"":false}},{{""Id"":181,""TemplateId"":3015001,""CharacterId"":1021001,""Level"":45,""Exp"":260,""Breakthrough"":4,""ResonanceInfo"":[],""UnconfirmedResonanceInfo"":[],""AwakeSlotList"":[],""IsLock"":false,""CreateTime"":1626638512,""IsRecycle"":false}},{{""Id"":182,""TemplateId"":3045001,""CharacterId"":1021001,""Level"":45,""Exp"":10,""Breakthrough"":4,""ResonanceInfo"":[{{""Slot"":1,""Type"":1,""CharacterId"":0,""TemplateId"":27}},{{""Slot"":2,""Type"":1,""CharacterId"":0,""TemplateId"":26}}],""UnconfirmedResonanceInfo"":[],""AwakeSlotList"":[],""IsLock"":false,""CreateTime"":1626638512,""IsRecycle"":false}},{{""Id"":521,""TemplateId"":3055002,""CharacterId"":1021001,""Level"":1,""Exp"":0,""Breakthrough"":4,""ResonanceInfo"":[],""UnconfirmedResonanceInfo"":[],""AwakeSlotList"":[],""IsLock"":false,""CreateTime"":1626792402,""IsRecycle"":false}}],""AttribGroupList"":[],""CharacterSkillPlus"":null,""EquipSkillPlus"":[],""AttribReviseId"":0,""EventIds"":[],""FightEventsWithLevel"":{{}},""WeaponFashionId"":0,""Partner"":null,""IsRobot"":false,""AttrRateTable"":{{}}}}}},""CustomNpc"":null,""AssistNpcData"":null}}],""ReviseId"":0,""PlayerLevel"":0,""NpcGroupList"":null,""FightControlData"":{{""MaxFight"":0,""MaxRecommendFight"":0,""MaxShowFight"":0,""AvgFight"":0,""AvgRecommendFight"":0,""AvgShowFight"":0}},""DisableJoystick"":false,""Restartable"":false,""DisableDeadEffect"":false,""CustomData"":null,""Records"":{{}},""StStageDropData"":null}}}}"));
session.SendResponse(rsp, packet.Id);
2023-10-14 17:16:45 +00:00
}
[RequestPacketHandler("TeamSetTeamRequest")]
public static void HandleTeamSetTeamRequestHandler(Session session, Packet.Request packet)
{
session.SendResponse(new TeamSetTeamResponse(), packet.Id);
}
[RequestPacketHandler("FightSettleRequest")]
public static void FightSettleRequestHandler(Session session, Packet.Request packet)
{
FightSettleRequest req = MessagePackSerializer.Deserialize<FightSettleRequest>(packet.Content);
session.SendPush("NotifyStageData", MessagePackSerializer.ConvertFromJson($"{{\"StageList\": [{{\"StageId\": {req.Result.StageId}, \"StarsMark\": 7, \"Passed\": true, \"PassTimesToday\": 1, \"PassTimesTotal\": 2, \"BuyCount\": 0, \"Score\": 0, \"LastPassTime\": {DateTimeOffset.UtcNow.ToUnixTimeSeconds()}, \"RefreshTime\": {DateTimeOffset.UtcNow.ToUnixTimeSeconds()}, \"CreateTime\": 1626546618, \"BestRecordTime\": 17, \"LastRecordTime\": 17, \"BestCardIds\": [1021001, 1031003, 1051001], \"LastCardIds\": [1021001, 1031003, 1051001]}}]}}"));
2023-10-14 17:34:14 +00:00
session.SendResponse(MessagePackSerializer.Deserialize<PreFightResponse>(MessagePackSerializer.ConvertFromJson($"{{\"Code\": 0, \"Settle\": {{\"IsWin\": true, \"StageId\": {req.Result.StageId}, \"StarsMark\": 7, \"RewardGoodsList\": [{{\"RewardType\": 1, \"TemplateId\": 1, \"Count\": 1947, \"Level\": 0, \"Quality\": 0, \"Grade\": 0, \"Breakthrough\": 0, \"ConvertFrom\": 0, \"Id\": 0}}, {{\"RewardType\": 1, \"TemplateId\": 30011, \"Count\": 1, \"Level\": 0, \"Quality\": 0, \"Grade\": 0, \"Breakthrough\": 0, \"ConvertFrom\": 0, \"Id\": 0}}, {{\"RewardType\": 1, \"TemplateId\": 30011, \"Count\": 1, \"Level\": 0, \"Quality\": 0, \"Grade\": 0, \"Breakthrough\": 0, \"ConvertFrom\": 0, \"Id\": 0}}, {{\"RewardType\": 3, \"TemplateId\": 3052001, \"Count\": 1, \"Level\": 1, \"Quality\": 0, \"Grade\": 0, \"Breakthrough\": 0, \"ConvertFrom\": 0, \"Id\": 0}}, {{\"RewardType\": 3, \"TemplateId\": 3034002, \"Count\": 1, \"Level\": 1, \"Quality\": 0, \"Grade\": 0, \"Breakthrough\": 0, \"ConvertFrom\": 0, \"Id\": 0}}], \"LeftTime\": 282, \"NpcHpInfo\": {{\"9\": {{\"CharacterId\": 0, \"NpcId\": 91030, \"Type\": 4, \"Level\": 7, \"BuffIds\": [9003, 900007, 900050, 701022, 900011, 900051, 910300, 715531, 700053, 715075, 700007, 900080, 700045, 100062, 700030, 700029, 710076, 700027, 700215, 700028], \"AttrTable\": {{\"1\": {{\"Value\": 1, \"MaxValue\": 751}}, \"2\": {{\"Value\": 0, \"MaxValue\": 100}}, \"3\": {{\"Value\": 84, \"MaxValue\": 84}}, \"4\": {{\"Value\": 84, \"MaxValue\": 84}}, \"5\": {{\"Value\": 418, \"MaxValue\": 418}}, \"11\": {{\"Value\": 50, \"MaxValue\": 50}}, \"12\": {{\"Value\": 50, \"MaxValue\": 50}}, \"13\": {{\"Value\": 50, \"MaxValue\": 50}}, \"14\": {{\"Value\": 50, \"MaxValue\": 50}}, \"15\": {{\"Value\": 50, \"MaxValue\": 50}}, \"23\": {{\"Value\": 31, \"MaxValue\": 31}}, \"24\": {{\"Value\": 37, \"MaxValue\": 37}}, \"32\": {{\"Value\": 30, \"MaxValue\": 30}}, \"34\": {{\"Value\": 2030, \"MaxValue\": 2030}}, \"35\": {{\"Value\": 2030, \"MaxValue\": 2030}}, \"36\": {{\"Value\": 2030, \"MaxValue\": 2030}}, \"37\": {{\"Value\": 2030, \"MaxValue\": 2030}}, \"40\": {{\"Value\": 10000, \"MaxValue\": 10000}}, \"41\": {{\"Value\": 10000, \"MaxValue\": 10000}}, \"42\": {{\"Value\": 10000, \"MaxValue\": 10000}}, \"44\": {{\"Value\": 1, \"MaxValue\": 1}}, \"46\": {{\"Value\": 20000, \"MaxValue\": 20000}}, \"54\": {{\"Value\": 1000, \"MaxValue\": 1000}}, \"68\": {{\"Value\": 99, \"MaxValue\": 99}}, \"74\": {{\"Value\": 349, \"MaxValue\": 349}}}}}}, \"10\": {{\"CharacterId\": 0, \"NpcId\": 92090, \"Type\": 4, \"Level\": 7, \"BuffIds\": [9009, 900007, 900050, 900055, 900011, 900051, 900072, 715531, 700053, 715075, 700007, 900080, 700028, 700045, 100062, 700030, 700029, 701022, 710076, 700027, 700215], \"AttrTable\": {{\"1\": {{\"Value\": 1, \"MaxValue\": 301}}, \"2\": {{\"Value\": 0, \"MaxValue\": 100}}, \"3\": {{\"Value\": 84, \"MaxValue\": 84}}, \"4\": {{\"Value\": 84, \"MaxValue\": 84}}, \"5\": {{\"Value\": 418, \"MaxValue\": 418}}, \"11\": {{\"Value\": 50, \"MaxValue\": 50}}, \"12\": {{\"Value\": 50, \"MaxValue\": 50}}, \"13\": {{\"Value\": 50, \"MaxValue\": 50}}, \"14\": {{\"Value\": 50, \"MaxValue\": 50}}, \"15\": {{\"Value\": 50, \"MaxValue\": 50}}, \"23\": {{\"Value\": 31, \"MaxValue\": 31}}, \"24\": {{\"Value\": 37, \"MaxValue\": 37}}, \"32\": {{\"Value\": 30, \"MaxValue\": 30}}, \"34\": {{\"Value\": 2030, \"MaxValue\": 2030}}, \"35\": {{\"Value\": 2030, \"MaxValue\": 2030}}, \"36\": {{\"Value\": 2030, \"MaxValue\": 2030}}, \"37\": {{\"Value\": 2030, \"MaxValue\": 2030}}, \"40\": {{\"Value\": 10000, \"MaxValue\": 10000}}, \"41\": {{\"Value\": 10000, \"MaxValue\": 10000}}, \"42\": {{\"Value\": 10000, \"MaxValue\": 10000}}, \"44\": {{\"Value\": 1, \"MaxValue\": 1}}, \"46\": {{\"Value\": 20000, \"MaxValue\": 20000}}, \"54\": {{\"Value\": 1000, \"MaxValue\": 1000}}, \"68\": {{\"Value\": 99, \"MaxValue\": 99}}, \"74\": {{\"Value\": 349, \"MaxValue\": 349}}}}}}, \"11\": {{\"CharacterId\": 0, \"NpcId\": 92090, \"Type\": 4, \"Level\": 7, \"BuffIds\": [9009, 900007, 900050, 900072, 900011, 900051, 700028, 715531, 7
2023-10-14 17:16:45 +00:00
}
}
}