server-master/srcs/WingsAPI.Game/Raids/RaidComponent.cs
2026-02-10 18:21:30 +01:00

53 lines
No EOL
1.1 KiB
C#

using WingsEmu.Game.Networking;
namespace WingsEmu.Game.Raids;
public class RaidComponent : IRaidComponent
{
public RaidParty Raid { get; private set; }
public byte RaidDeaths { get; private set; }
public bool IsRaidLeader(long characterId)
{
if (!IsInRaidParty)
{
return false;
}
if (Raid?.Members == null || Raid.Members.Count < 1)
{
return false;
}
IClientSession leader = Raid.Members[0];
return leader?.PlayerEntity.Id == characterId;
}
public bool RaidTeamIsFull => Raid != null && Raid.Members.Count >= Raid.MaximumMembers;
public bool IsInRaidParty => Raid != null;
public bool HasRaidStarted => Raid is { Started: true };
public void SetRaidParty(RaidParty raidParty)
{
Raid = raidParty;
RaidDeaths = 0;
}
public void AddRaidDeath()
{
RaidDeaths++;
}
public void RemoveRaidDeath()
{
if (RaidDeaths < 1)
{
RaidDeaths = 0;
return;
}
RaidDeaths--;
}
}