//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.GameLogic;
using MUnique.OpenMU.GameLogic.Views;
using MUnique.OpenMU.Interfaces;
using MUnique.OpenMU.Pathfinding;
using MUnique.OpenMU.PlugIns;
using Nito.AsyncEx;
///
/// A party member who is currently offline.
///
public sealed class OfflinePartyMember : IPartyMember
{
///
/// Initializes a new instance of the class.
///
/// The player.
public OfflinePartyMember(IPartyMember player)
{
this.Name = player.Name;
this.Id = player.Id;
this.CurrentHealth = player.CurrentHealth;
this.MaximumHealth = player.MaximumHealth;
this.CurrentMap = player.CurrentMap;
this.Position = player.Position;
this.Logger = player?.Logger ?? Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance;
}
///
public Party? Party { get; set; }
///
public IPartyMember? LastPartyRequester { get; set; }
///
public uint MaximumHealth { get; }
///
public uint CurrentHealth { get; }
///
public string Name { get; }
///
public bool IsConnected => false;
///
public ushort Id { get; }
///
public Point Position { get; set; }
///
public GameMap? CurrentMap { get; }
///
public ICustomPlugInContainer ViewPlugIns { get; } = new DummyViewPlugInContainer();
///
public AsyncReaderWriterLock ObserverLock { get; } = new();
///
public ISet Observers { get; } = new HashSet();
///
public ILogger Logger { get; }
///
public ValueTask AddObserverAsync(IWorldObserver observer) => ValueTask.CompletedTask;
///
public ValueTask RemoveObserverAsync(IWorldObserver observer) => ValueTask.CompletedTask;
private class DummyViewPlugInContainer : ICustomPlugInContainer
{
public T? GetPlugIn()
where T : class, IViewPlugIn => null;
}
}