mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Update to API4, use IPC instead of API-project. Replace Actor in most visible names with Object, Character or Player..
This commit is contained in:
parent
3680d2b63f
commit
4dfc2cf665
60 changed files with 812 additions and 740 deletions
|
|
@ -1,28 +1,30 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Game.ClientState.Actors.Types;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Penumbra.PlayerWatch
|
||||
{
|
||||
public class PlayerWatcher : IPlayerWatcher
|
||||
{
|
||||
public int Version { get; } = 1;
|
||||
public int Version { get; } = 2;
|
||||
|
||||
private static PlayerWatchBase? _playerWatch;
|
||||
|
||||
public event ActorChange? ActorChanged;
|
||||
public event PlayerChange? PlayerChanged;
|
||||
|
||||
public bool Active { get; set; } = true;
|
||||
|
||||
public bool Valid
|
||||
=> _playerWatch != null;
|
||||
|
||||
internal PlayerWatcher( DalamudPluginInterface pi )
|
||||
internal PlayerWatcher( Framework framework, ClientState clientState, ObjectTable objects )
|
||||
{
|
||||
_playerWatch ??= new PlayerWatchBase( pi );
|
||||
_playerWatch ??= new PlayerWatchBase( framework, clientState, objects );
|
||||
_playerWatch.RegisterWatcher( this );
|
||||
}
|
||||
|
||||
|
|
@ -38,8 +40,8 @@ namespace Penumbra.PlayerWatch
|
|||
_playerWatch?.CheckActiveStatus();
|
||||
}
|
||||
|
||||
internal void Trigger( Actor actor )
|
||||
=> ActorChanged?.Invoke( actor );
|
||||
internal void Trigger( Character actor )
|
||||
=> PlayerChanged?.Invoke( actor );
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
@ -48,8 +50,8 @@ namespace Penumbra.PlayerWatch
|
|||
return;
|
||||
}
|
||||
|
||||
Active = false;
|
||||
ActorChanged = null;
|
||||
Active = false;
|
||||
PlayerChanged = null;
|
||||
_playerWatch.UnregisterWatcher( this );
|
||||
if( _playerWatch.RegisteredWatchers.Count == 0 )
|
||||
{
|
||||
|
|
@ -78,13 +80,13 @@ namespace Penumbra.PlayerWatch
|
|||
_playerWatch!.RemovePlayerFromWatch( playerName, this );
|
||||
}
|
||||
|
||||
public ActorEquipment UpdateActorWithoutEvent( Actor actor )
|
||||
public CharacterEquipment UpdatePlayerWithoutEvent( Character actor )
|
||||
{
|
||||
CheckValidity();
|
||||
return _playerWatch!.UpdateActorWithoutEvent( actor );
|
||||
return _playerWatch!.UpdatePlayerWithoutEvent( actor );
|
||||
}
|
||||
|
||||
public IEnumerable< (string, ActorEquipment) > WatchedPlayers()
|
||||
public IEnumerable< (string, CharacterEquipment) > WatchedPlayers()
|
||||
{
|
||||
CheckValidity();
|
||||
return _playerWatch!.Equip
|
||||
|
|
@ -95,7 +97,7 @@ namespace Penumbra.PlayerWatch
|
|||
|
||||
public static class PlayerWatchFactory
|
||||
{
|
||||
public static IPlayerWatcher Create( DalamudPluginInterface pi )
|
||||
=> new PlayerWatcher( pi );
|
||||
public static IPlayerWatcher Create( Framework framework, ClientState clientState, ObjectTable objects )
|
||||
=> new PlayerWatcher( framework, clientState, objects );
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue