mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-01-03 06:13:45 +01:00
Make line endings explicit in editorconfig and share in sub projects, also apply editorconfig everywhere and move some namespaces.
This commit is contained in:
parent
53adb6fa54
commit
2b4a01df06
155 changed files with 1620 additions and 1614 deletions
|
|
@ -16,18 +16,18 @@ public static class ActiveCollectionMigration
|
|||
foreach (var (type, _, _) in CollectionTypeExtensions.Special.Where(t => t.Item2.StartsWith("Male ")))
|
||||
{
|
||||
var oldName = type.ToString()[4..];
|
||||
var value = jObject[oldName];
|
||||
var value = jObject[oldName];
|
||||
if (value == null)
|
||||
continue;
|
||||
|
||||
jObject.Remove(oldName);
|
||||
jObject.Add("Male" + oldName, value);
|
||||
jObject.Add("Male" + oldName, value);
|
||||
jObject.Add("Female" + oldName, value);
|
||||
}
|
||||
|
||||
using var stream = File.Open(fileNames.ActiveCollectionsFile, FileMode.Truncate);
|
||||
using var writer = new StreamWriter(stream);
|
||||
using var j = new JsonTextWriter(writer);
|
||||
using var j = new JsonTextWriter(writer);
|
||||
j.Formatting = Formatting.Indented;
|
||||
jObject.WriteTo(j);
|
||||
}
|
||||
|
|
@ -41,13 +41,14 @@ public static class ActiveCollectionMigration
|
|||
|
||||
// Load character collections. If a player name comes up multiple times, the last one is applied.
|
||||
var characters = jObject["Characters"]?.ToObject<Dictionary<string, string>>() ?? new Dictionary<string, string>();
|
||||
var dict = new Dictionary<string, ModCollection>(characters.Count);
|
||||
var dict = new Dictionary<string, ModCollection>(characters.Count);
|
||||
foreach (var (player, collectionName) in characters)
|
||||
{
|
||||
if (!storage.ByName(collectionName, out var collection))
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
$"Last choice of <{player}>'s Collection {collectionName} is not available, reset to {ModCollection.Empty.Name}.", "Load Failure",
|
||||
$"Last choice of <{player}>'s Collection {collectionName} is not available, reset to {ModCollection.Empty.Name}.",
|
||||
"Load Failure",
|
||||
NotificationType.Warning);
|
||||
dict.Add(player, ModCollection.Empty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -442,6 +442,7 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
var m = ByType(CollectionTypeExtensions.FromParts(race, Gender.Male, false));
|
||||
if (m != null && m != yourself)
|
||||
return string.Empty;
|
||||
|
||||
var f = ByType(CollectionTypeExtensions.FromParts(race, Gender.Female, false));
|
||||
if (f != null && f != yourself)
|
||||
return string.Empty;
|
||||
|
|
@ -450,26 +451,28 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
}
|
||||
|
||||
var racialString = racial ? " and Racial Assignments" : string.Empty;
|
||||
var @base = ByType(CollectionType.Default);
|
||||
var male = ByType(CollectionType.MalePlayerCharacter);
|
||||
var female = ByType(CollectionType.FemalePlayerCharacter);
|
||||
var @base = ByType(CollectionType.Default);
|
||||
var male = ByType(CollectionType.MalePlayerCharacter);
|
||||
var female = ByType(CollectionType.FemalePlayerCharacter);
|
||||
if (male == yourself && female == yourself)
|
||||
return
|
||||
$"Assignment is redundant due to overwriting Male Players and Female Players{racialString} with an identical collection.\nYou can remove it.";
|
||||
|
||||
|
||||
if (male == null)
|
||||
{
|
||||
if (female == null && @base == yourself)
|
||||
return $"Assignment is redundant due to overwriting Base{racialString} with an identical collection.\nYou can remove it.";
|
||||
return
|
||||
$"Assignment is redundant due to overwriting Base{racialString} with an identical collection.\nYou can remove it.";
|
||||
if (female == yourself && @base == yourself)
|
||||
return
|
||||
$"Assignment is redundant due to overwriting Base and Female Players{racialString} with an identical collection.\nYou can remove it.";
|
||||
}
|
||||
else if (male == yourself && female == null && @base == yourself)
|
||||
{
|
||||
return $"Assignment is redundant due to overwriting Base and Male Players{racialString} with an identical collection.\nYou can remove it.";
|
||||
return
|
||||
$"Assignment is redundant due to overwriting Base and Male Players{racialString} with an identical collection.\nYou can remove it.";
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
// Check individual assignments. We can only be sure of redundancy for world-overlap or ownership overlap.
|
||||
case CollectionType.Individual:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using OtterGui;
|
|||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Mods.Subclasses;
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Collections.Manager;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using OtterGui.Filesystem;
|
|||
using Penumbra.Communication;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Mods.Subclasses;
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Collections.Manager;
|
||||
|
|
@ -246,7 +247,7 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable
|
|||
private void OnModPathChange(ModPathChangeType type, Mod mod, DirectoryInfo? oldDirectory,
|
||||
DirectoryInfo? newDirectory)
|
||||
{
|
||||
switch (type)
|
||||
switch (type)
|
||||
{
|
||||
case ModPathChangeType.Added:
|
||||
foreach (var collection in this)
|
||||
|
|
|
|||
|
|
@ -427,13 +427,13 @@ public static class CollectionTypeExtensions
|
|||
public static string ToDescription(this CollectionType collectionType)
|
||||
=> collectionType switch
|
||||
{
|
||||
CollectionType.Default => "World, Music, Furniture, baseline for characters and monsters not specialized.",
|
||||
CollectionType.Interface => "User Interface, Icons, Maps, Styles.",
|
||||
CollectionType.Yourself => "Your characters, regardless of name, race or gender. Applies in the login screen.",
|
||||
CollectionType.MalePlayerCharacter => "Baseline for male player characters.",
|
||||
CollectionType.FemalePlayerCharacter => "Baseline for female player characters.",
|
||||
CollectionType.MaleNonPlayerCharacter => "Baseline for humanoid male non-player characters.",
|
||||
CollectionType.Default => "World, Music, Furniture, baseline for characters and monsters not specialized.",
|
||||
CollectionType.Interface => "User Interface, Icons, Maps, Styles.",
|
||||
CollectionType.Yourself => "Your characters, regardless of name, race or gender. Applies in the login screen.",
|
||||
CollectionType.MalePlayerCharacter => "Baseline for male player characters.",
|
||||
CollectionType.FemalePlayerCharacter => "Baseline for female player characters.",
|
||||
CollectionType.MaleNonPlayerCharacter => "Baseline for humanoid male non-player characters.",
|
||||
CollectionType.FemaleNonPlayerCharacter => "Baseline for humanoid female non-player characters.",
|
||||
_ => string.Empty,
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ public sealed partial class IndividualCollections : IReadOnlyList<(string Displa
|
|||
return true;
|
||||
|
||||
// Handle generic NPC
|
||||
var npcIdentifier = _actorService.AwaitedService.CreateIndividualUnchecked(IdentifierType.Npc, ByteString.Empty, ushort.MaxValue,
|
||||
var npcIdentifier = _actorService.AwaitedService.CreateIndividualUnchecked(IdentifierType.Npc, ByteString.Empty,
|
||||
ushort.MaxValue,
|
||||
identifier.Kind, identifier.DataId);
|
||||
if (npcIdentifier.IsValid && _individuals.TryGetValue(npcIdentifier, out collection))
|
||||
return true;
|
||||
|
|
@ -56,7 +57,8 @@ public sealed partial class IndividualCollections : IReadOnlyList<(string Displa
|
|||
if (!_config.UseOwnerNameForCharacterCollection)
|
||||
return false;
|
||||
|
||||
identifier = _actorService.AwaitedService.CreateIndividualUnchecked(IdentifierType.Player, identifier.PlayerName, identifier.HomeWorld.Id,
|
||||
identifier = _actorService.AwaitedService.CreateIndividualUnchecked(IdentifierType.Player, identifier.PlayerName,
|
||||
identifier.HomeWorld.Id,
|
||||
ObjectKind.None, uint.MaxValue);
|
||||
return CheckWorlds(identifier, out collection);
|
||||
}
|
||||
|
|
@ -142,7 +144,8 @@ public sealed partial class IndividualCollections : IReadOnlyList<(string Displa
|
|||
if (_individuals.TryGetValue(identifier, out collection))
|
||||
return true;
|
||||
|
||||
identifier = _actorService.AwaitedService.CreateIndividualUnchecked(identifier.Type, identifier.PlayerName, ushort.MaxValue, identifier.Kind,
|
||||
identifier = _actorService.AwaitedService.CreateIndividualUnchecked(identifier.Type, identifier.PlayerName, ushort.MaxValue,
|
||||
identifier.Kind,
|
||||
identifier.DataId);
|
||||
if (identifier.IsValid && _individuals.TryGetValue(identifier, out collection))
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public partial class IndividualCollections
|
|||
{
|
||||
if (_actorService.Valid)
|
||||
return ReadJObjectInternal(obj, storage);
|
||||
|
||||
void Func()
|
||||
{
|
||||
if (ReadJObjectInternal(obj, storage))
|
||||
|
|
@ -35,9 +36,10 @@ public partial class IndividualCollections
|
|||
Loaded.Invoke();
|
||||
_actorService.FinishedCreation -= Func;
|
||||
}
|
||||
|
||||
_actorService.FinishedCreation += Func;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool ReadJObjectInternal(JArray? obj, CollectionStorage storage)
|
||||
{
|
||||
|
|
@ -85,6 +87,7 @@ public partial class IndividualCollections
|
|||
NotificationType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
return changes;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,8 @@ public sealed partial class IndividualCollections
|
|||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
return table.Where(kvp => kvp.Value == name)
|
||||
.Select(kvp => manager.CreateIndividualUnchecked(identifier.Type, identifier.PlayerName, identifier.HomeWorld.Id, identifier.Kind,
|
||||
.Select(kvp => manager.CreateIndividualUnchecked(identifier.Type, identifier.PlayerName, identifier.HomeWorld.Id,
|
||||
identifier.Kind,
|
||||
kvp.Key)).ToArray();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Penumbra.Mods;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Mods.Subclasses;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue