mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
fix: cannot exit raid scene
This commit is contained in:
@@ -834,7 +834,7 @@ public class PlayerInstance(PlayerData data)
|
||||
Data.Pos = pos;
|
||||
Data.Rot = rot;
|
||||
var notSendMove = true;
|
||||
if (planeId != Data.PlaneId || floorId != Data.FloorId || entryId != Data.EntryId || SceneInstance == null)
|
||||
if (planeId != Data.PlaneId || floorId != Data.FloorId || entryId != Data.EntryId || SceneInstance == null || !mapTp)
|
||||
{
|
||||
if (SceneInstance != null)
|
||||
await SceneInstance.OnDestroy();
|
||||
|
||||
@@ -61,12 +61,12 @@ public class RaidManager : BasePlayerManager
|
||||
|
||||
#region Player Action
|
||||
|
||||
public async ValueTask EnterRaid(int raidId, int worldLevel, List<int>? avatarList = null, bool enterSaved = false)
|
||||
public async ValueTask<RaidRecord?> EnterRaid(int raidId, int worldLevel, List<int>? avatarList = null, bool enterSaved = false)
|
||||
{
|
||||
if (RaidData.CurRaidId != 0) return;
|
||||
if (RaidData.CurRaidId != 0) return null;
|
||||
|
||||
GameData.RaidConfigData.TryGetValue(raidId * 100 + worldLevel, out var excel);
|
||||
if (excel == null) return; // not exist
|
||||
if (excel == null) return null; // not exist
|
||||
|
||||
RaidData.RaidRecordDatas.TryGetValue(raidId, out var dict);
|
||||
dict ??= [];
|
||||
@@ -177,6 +177,7 @@ public class RaidManager : BasePlayerManager
|
||||
}
|
||||
|
||||
await Player.SendPacket(new PacketRaidInfoNotify(record));
|
||||
return record;
|
||||
}
|
||||
|
||||
public async ValueTask CheckIfLeaveRaid()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Raid;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.Raid;
|
||||
@@ -11,10 +12,13 @@ public class HandlerStartRaidCsReq : Handler
|
||||
var req = StartRaidCsReq.Parser.ParseFrom(data);
|
||||
var player = connection.Player!;
|
||||
|
||||
await player.RaidManager!.EnterRaid((int)req.RaidId, (int)req.WorldLevel,
|
||||
var record = await player.RaidManager!.EnterRaid((int)req.RaidId, (int)req.WorldLevel,
|
||||
req.AvatarList.Select(x => (int)x).ToList(),
|
||||
req.IsSave == 1);
|
||||
|
||||
await connection.SendPacket(CmdIds.StartRaidScRsp);
|
||||
if (record == null)
|
||||
await connection.SendPacket(new PacketStartRaidScRsp(Retcode.RetReqParaInvalid));
|
||||
else
|
||||
await connection.SendPacket(new PacketStartRaidScRsp(record, player));
|
||||
}
|
||||
}
|
||||
35
GameServer/Server/Packet/Send/Raid/PacketStartRaidScRsp.cs
Normal file
35
GameServer/Server/Packet/Send/Raid/PacketStartRaidScRsp.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using EggLink.DanhengServer.Database.Scene;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Raid;
|
||||
|
||||
public class PacketStartRaidScRsp : BasePacket
|
||||
{
|
||||
public PacketStartRaidScRsp(RaidRecord record, PlayerInstance player) : base(CmdIds.StartRaidScRsp)
|
||||
{
|
||||
var proto = new StartRaidScRsp
|
||||
{
|
||||
Scene = new RaidPlayerData
|
||||
{
|
||||
Lineup = player.LineupManager!.GetCurLineup()!.ToProto(),
|
||||
RaidId = (uint)record.RaidId,
|
||||
RaidSceneInfo = player.SceneInstance!.ToProto(),
|
||||
WorldLevel = (uint)record.WorldLevel
|
||||
}
|
||||
};
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
public PacketStartRaidScRsp(Retcode ret) : base(CmdIds.StartRaidScRsp)
|
||||
{
|
||||
var proto = new StartRaidScRsp
|
||||
{
|
||||
Retcode = (uint)ret
|
||||
};
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user