mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Remove static ActorService.
This commit is contained in:
parent
be3c1c85aa
commit
2c55701cbf
4 changed files with 17 additions and 12 deletions
|
|
@ -111,7 +111,7 @@ public class MetaCache : IDisposable, IEnumerable<KeyValuePair<MetaManipulation,
|
|||
public bool RevertMod(MetaManipulation manip)
|
||||
{
|
||||
var ret = _manipulations.Remove(manip);
|
||||
if (!Penumbra.CharacterUtility.Ready)
|
||||
if (!_manager.CharacterUtility.Ready)
|
||||
return ret;
|
||||
|
||||
// Imc manipulations do not require character utility,
|
||||
|
|
|
|||
|
|
@ -30,10 +30,13 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
private readonly CommunicatorService _communicator;
|
||||
private readonly SaveService _saveService;
|
||||
private readonly ActiveCollectionData _data;
|
||||
private readonly ActorService _actors;
|
||||
|
||||
public ActiveCollections(Configuration config, CollectionStorage storage, ActorService actors, CommunicatorService communicator, SaveService saveService, ActiveCollectionData data)
|
||||
public ActiveCollections(Configuration config, CollectionStorage storage, ActorService actors, CommunicatorService communicator,
|
||||
SaveService saveService, ActiveCollectionData data)
|
||||
{
|
||||
_storage = storage;
|
||||
_actors = actors;
|
||||
_communicator = communicator;
|
||||
_saveService = saveService;
|
||||
_data = data;
|
||||
|
|
@ -190,7 +193,9 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
else
|
||||
{
|
||||
if (collection == null)
|
||||
{
|
||||
RemoveSpecialCollection(collectionType);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateSpecialCollection(collectionType);
|
||||
|
|
@ -207,8 +212,9 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
CollectionType.Default => Default,
|
||||
CollectionType.Interface => Interface,
|
||||
CollectionType.Current => Current,
|
||||
CollectionType.Individual when individualIndex >= 0 && individualIndex < Individuals.Count => Individuals[individualIndex].Collection,
|
||||
CollectionType.Individual => null,
|
||||
CollectionType.Individual when individualIndex >= 0 && individualIndex < Individuals.Count => Individuals[individualIndex]
|
||||
.Collection,
|
||||
CollectionType.Individual => null,
|
||||
_ when collectionType.IsSpecial() => SpecialCollections[(int)collectionType] ?? Default,
|
||||
_ => null,
|
||||
};
|
||||
|
|
@ -433,7 +439,7 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
{
|
||||
case IdentifierType.Player when id.HomeWorld != ushort.MaxValue:
|
||||
{
|
||||
var global = ByType(CollectionType.Individual, Penumbra.Actors.CreatePlayer(id.PlayerName, ushort.MaxValue));
|
||||
var global = ByType(CollectionType.Individual, _actors.AwaitedService.CreatePlayer(id.PlayerName, ushort.MaxValue));
|
||||
return global?.Index == checkAssignment.Index
|
||||
? "Assignment is redundant due to an identical Any-World assignment existing.\nYou can remove it."
|
||||
: string.Empty;
|
||||
|
|
@ -442,12 +448,12 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
if (id.HomeWorld != ushort.MaxValue)
|
||||
{
|
||||
var global = ByType(CollectionType.Individual,
|
||||
Penumbra.Actors.CreateOwned(id.PlayerName, ushort.MaxValue, id.Kind, id.DataId));
|
||||
_actors.AwaitedService.CreateOwned(id.PlayerName, ushort.MaxValue, id.Kind, id.DataId));
|
||||
if (global?.Index == checkAssignment.Index)
|
||||
return "Assignment is redundant due to an identical Any-World assignment existing.\nYou can remove it.";
|
||||
}
|
||||
|
||||
var unowned = ByType(CollectionType.Individual, Penumbra.Actors.CreateNpc(id.Kind, id.DataId));
|
||||
var unowned = ByType(CollectionType.Individual, _actors.AwaitedService.CreateNpc(id.Kind, id.DataId));
|
||||
return unowned?.Index == checkAssignment.Index
|
||||
? "Assignment is redundant due to an identical unowned NPC assignment existing.\nYou can remove it."
|
||||
: string.Empty;
|
||||
|
|
|
|||
|
|
@ -17,11 +17,13 @@ public class TempCollectionManager : IDisposable
|
|||
|
||||
private readonly CommunicatorService _communicator;
|
||||
private readonly CollectionStorage _storage;
|
||||
private readonly ActorService _actors;
|
||||
private readonly Dictionary<string, ModCollection> _customCollections = new();
|
||||
|
||||
public TempCollectionManager(Configuration config, CommunicatorService communicator, ActorService actors, CollectionStorage storage)
|
||||
{
|
||||
_communicator = communicator;
|
||||
_actors = actors;
|
||||
_storage = storage;
|
||||
Collections = new IndividualCollections(actors, config);
|
||||
|
||||
|
|
@ -97,7 +99,6 @@ public class TempCollectionManager : IDisposable
|
|||
Penumbra.Log.Verbose($"Assigned temporary collection {collection.AnonymizedName} to {Collections.Last().DisplayName}.");
|
||||
_communicator.CollectionChange.Invoke(CollectionType.Temporary, null, collection, Collections.Last().DisplayName);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public bool AddIdentifier(string collectionName, params ActorIdentifier[] identifiers)
|
||||
|
|
@ -113,7 +114,7 @@ public class TempCollectionManager : IDisposable
|
|||
if (!ByteString.FromString(characterName, out var byteString, false))
|
||||
return false;
|
||||
|
||||
var identifier = Penumbra.Actors.CreatePlayer(byteString, worldId);
|
||||
var identifier = _actors.AwaitedService.CreatePlayer(byteString, worldId);
|
||||
if (!identifier.IsValid)
|
||||
return false;
|
||||
|
||||
|
|
@ -125,7 +126,7 @@ public class TempCollectionManager : IDisposable
|
|||
if (!ByteString.FromString(characterName, out var byteString, false))
|
||||
return false;
|
||||
|
||||
var identifier = Penumbra.Actors.CreatePlayer(byteString, worldId);
|
||||
var identifier = _actors.AwaitedService.CreatePlayer(byteString, worldId);
|
||||
return Collections.TryGetValue(identifier, out var collection) && RemoveTemporaryCollection(collection.Name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ public class Penumbra : IDalamudPlugin
|
|||
|
||||
public static CharacterUtility CharacterUtility { get; private set; } = null!;
|
||||
public static CollectionManager CollectionManager { get; private set; } = null!;
|
||||
public static ActorManager Actors { get; private set; } = null!;
|
||||
|
||||
public readonly RedrawService RedrawService;
|
||||
public readonly ModFileSystem ModFileSystem;
|
||||
|
|
@ -68,7 +67,6 @@ public class Penumbra : IDalamudPlugin
|
|||
_tmp.Services.GetRequiredService<BackupService>();
|
||||
_config = _tmp.Services.GetRequiredService<Configuration>();
|
||||
CharacterUtility = _tmp.Services.GetRequiredService<CharacterUtility>();
|
||||
Actors = _tmp.Services.GetRequiredService<ActorService>().AwaitedService;
|
||||
_tempMods = _tmp.Services.GetRequiredService<TempModManager>();
|
||||
_residentResources = _tmp.Services.GetRequiredService<ResidentResourceManager>();
|
||||
_tmp.Services.GetRequiredService<ResourceManagerService>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue