feat(hs): raise statue HP, transform players in-battle, per-player team roster packet, drop wing-unequip
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// <copyright file="HeykelSavasiTeamRosterPlugIn.cs" company="MUnique">
|
||||
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
|
||||
// </copyright>
|
||||
|
||||
namespace MUnique.OpenMU.GameServer.RemoteView.MiniGames;
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using MUnique.OpenMU.GameLogic;
|
||||
using MUnique.OpenMU.GameLogic.Views.MiniGames;
|
||||
using MUnique.OpenMU.Network;
|
||||
using MUnique.OpenMU.Network.Packets.ServerToClient;
|
||||
using MUnique.OpenMU.PlugIns;
|
||||
|
||||
/// <summary>
|
||||
/// The default implementation of the <see cref="IHeykelSavasiTeamRosterPlugIn"/> which is forwarding the
|
||||
/// team roster to the game client with a <see cref="HeykelSavasiTeamRosterRef"/> data packet (code 0xFC).
|
||||
/// </summary>
|
||||
[PlugIn]
|
||||
[Guid("b1f2a6d4-1c7e-4d3a-9b0e-6a2f5c8e4d11")]
|
||||
public class HeykelSavasiTeamRosterPlugIn : IHeykelSavasiTeamRosterPlugIn
|
||||
{
|
||||
private readonly RemotePlayer _player;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HeykelSavasiTeamRosterPlugIn"/> class.
|
||||
/// </summary>
|
||||
/// <param name="player">The player.</param>
|
||||
public HeykelSavasiTeamRosterPlugIn(RemotePlayer player) => this._player = player;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async ValueTask UpdateTeamRosterAsync(IReadOnlyList<(ushort PlayerId, byte Team)> entries)
|
||||
{
|
||||
var connection = this._player.Connection;
|
||||
if (connection is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// A byte Count field caps the roster at 255 entries; the event never has that many players.
|
||||
var count = entries.Count > byte.MaxValue ? byte.MaxValue : entries.Count;
|
||||
|
||||
int Write()
|
||||
{
|
||||
var size = HeykelSavasiTeamRosterRef.GetRequiredSize(count);
|
||||
var span = connection.Output.GetSpan(size)[..size];
|
||||
var packet = new HeykelSavasiTeamRosterRef(span)
|
||||
{
|
||||
Count = (byte)count,
|
||||
};
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var block = packet[i];
|
||||
block.PlayerId = entries[i].PlayerId;
|
||||
block.Team = entries[i].Team;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
await connection.SendAsync(Write).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user