mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-21 23:37:47 +01:00
Improved messaging.
This commit is contained in:
parent
19c4c3b50e
commit
779d6b37a5
30 changed files with 146 additions and 139 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui.Classes;
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Collections.Manager;
|
||||
|
|
@ -46,10 +47,8 @@ public static class ActiveCollectionMigration
|
|||
{
|
||||
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",
|
||||
NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Last choice of <{player}>'s Collection {collectionName} is not available, reset to {ModCollection.Empty.Name}.", NotificationType.Warning);
|
||||
dict.Add(player, ModCollection.Empty);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using Dalamud.Interface.Internal.Notifications;
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
|
@ -331,10 +332,8 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
?? (configChanged ? ModCollection.DefaultCollectionName : ModCollection.Empty.Name);
|
||||
if (!_storage.ByName(defaultName, out var defaultCollection))
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
$"Last choice of {TutorialService.DefaultCollection} {defaultName} is not available, reset to {ModCollection.Empty.Name}.",
|
||||
"Load Failure",
|
||||
NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Last choice of {TutorialService.DefaultCollection} {defaultName} is not available, reset to {ModCollection.Empty.Name}.", NotificationType.Warning);
|
||||
Default = ModCollection.Empty;
|
||||
configChanged = true;
|
||||
}
|
||||
|
|
@ -347,9 +346,8 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
var interfaceName = jObject[nameof(Interface)]?.ToObject<string>() ?? Default.Name;
|
||||
if (!_storage.ByName(interfaceName, out var interfaceCollection))
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
$"Last choice of {TutorialService.InterfaceCollection} {interfaceName} is not available, reset to {ModCollection.Empty.Name}.",
|
||||
"Load Failure", NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Last choice of {TutorialService.InterfaceCollection} {interfaceName} is not available, reset to {ModCollection.Empty.Name}.", NotificationType.Warning);
|
||||
Interface = ModCollection.Empty;
|
||||
configChanged = true;
|
||||
}
|
||||
|
|
@ -362,9 +360,8 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
var currentName = jObject[nameof(Current)]?.ToObject<string>() ?? Default.Name;
|
||||
if (!_storage.ByName(currentName, out var currentCollection))
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
$"Last choice of {TutorialService.SelectedCollection} {currentName} is not available, reset to {ModCollection.DefaultCollectionName}.",
|
||||
"Load Failure", NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Last choice of {TutorialService.SelectedCollection} {currentName} is not available, reset to {ModCollection.DefaultCollectionName}.", NotificationType.Warning);
|
||||
Current = _storage.DefaultNamed;
|
||||
configChanged = true;
|
||||
}
|
||||
|
|
@ -381,8 +378,7 @@ public class ActiveCollections : ISavable, IDisposable
|
|||
{
|
||||
if (!_storage.ByName(typeName, out var typeCollection))
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage($"Last choice of {name} Collection {typeName} is not available, removed.",
|
||||
"Load Failure",
|
||||
Penumbra.Messager.NotificationMessage($"Last choice of {name} Collection {typeName} is not available, removed.",
|
||||
NotificationType.Warning);
|
||||
configChanged = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Dalamud.Interface.Internal.Notifications;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.Mods;
|
||||
|
|
@ -102,9 +103,8 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable
|
|||
{
|
||||
if (!CanAddCollection(name, out var fixedName))
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
$"The new collection {name} would lead to the same path {fixedName} as one that already exists.", "Warning",
|
||||
NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"The new collection {name} would lead to the same path {fixedName} as one that already exists.", NotificationType.Warning, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -113,8 +113,7 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable
|
|||
_collections.Add(newCollection);
|
||||
|
||||
_saveService.ImmediateSave(new ModCollectionSave(_modStorage, newCollection));
|
||||
Penumbra.Chat.NotificationMessage($"Created new collection {newCollection.AnonymizedName}.", "Success",
|
||||
NotificationType.Success);
|
||||
Penumbra.Messager.NotificationMessage($"Created new collection {newCollection.AnonymizedName}.", NotificationType.Success, false);
|
||||
_communicator.CollectionChange.Invoke(CollectionType.Inactive, null, newCollection, string.Empty);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -126,13 +125,13 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable
|
|||
{
|
||||
if (collection.Index <= ModCollection.Empty.Index || collection.Index >= _collections.Count)
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage("Can not remove the empty collection.", "Error", NotificationType.Error);
|
||||
Penumbra.Messager.NotificationMessage("Can not remove the empty collection.", NotificationType.Error, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (collection.Index == DefaultNamed.Index)
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage("Can not remove the default collection.", "Error", NotificationType.Error);
|
||||
Penumbra.Messager.NotificationMessage("Can not remove the default collection.", NotificationType.Error, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +141,7 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable
|
|||
for (var i = collection.Index; i < Count; ++i)
|
||||
_collections[i].Index = i;
|
||||
|
||||
Penumbra.Chat.NotificationMessage($"Deleted collection {collection.AnonymizedName}.", "Success", NotificationType.Success);
|
||||
Penumbra.Messager.NotificationMessage($"Deleted collection {collection.AnonymizedName}.", NotificationType.Success, false);
|
||||
_communicator.CollectionChange.Invoke(CollectionType.Inactive, collection, null, string.Empty);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -185,23 +184,20 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable
|
|||
if (!IsValidName(name))
|
||||
{
|
||||
// TODO: handle better.
|
||||
Penumbra.Chat.NotificationMessage($"Collection of unsupported name found: {name} is not a valid collection name.",
|
||||
"Warning", NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage($"Collection of unsupported name found: {name} is not a valid collection name.", NotificationType.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ByName(name, out _))
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage($"Duplicate collection found: {name} already exists. Import skipped.",
|
||||
"Warning", NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage($"Duplicate collection found: {name} already exists. Import skipped.", NotificationType.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
var collection = ModCollection.CreateFromData(_saveService, _modStorage, name, version, Count, settings, inheritance);
|
||||
var correctName = _saveService.FileNames.CollectionFile(collection);
|
||||
if (file.FullName != correctName)
|
||||
Penumbra.Chat.NotificationMessage($"Collection {file.Name} does not correspond to {collection.Name}.", "Warning",
|
||||
NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage($"Collection {file.Name} does not correspond to {collection.Name}.", NotificationType.Warning);
|
||||
_collections.Add(collection);
|
||||
}
|
||||
|
||||
|
|
@ -221,9 +217,8 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable
|
|||
if (AddCollection(ModCollection.DefaultCollectionName, null))
|
||||
return _collections[^1];
|
||||
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
$"Unknown problem creating a collection with the name {ModCollection.DefaultCollectionName}, which is required to exist.", "Error",
|
||||
NotificationType.Error);
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Unknown problem creating a collection with the name {ModCollection.DefaultCollectionName}, which is required to exist.", NotificationType.Error);
|
||||
return Count > 1 ? _collections[1] : _collections[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui.Classes;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.String;
|
||||
|
|
@ -56,7 +57,7 @@ public partial class IndividualCollections
|
|||
if (group.Length == 0 || group.Any(i => !i.IsValid))
|
||||
{
|
||||
changes = true;
|
||||
Penumbra.Chat.NotificationMessage("Could not load an unknown individual collection, removed.", "Load Failure",
|
||||
Penumbra.Messager.NotificationMessage("Could not load an unknown individual collection, removed.",
|
||||
NotificationType.Warning);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -65,9 +66,8 @@ public partial class IndividualCollections
|
|||
if (collectionName.Length == 0 || !storage.ByName(collectionName, out var collection))
|
||||
{
|
||||
changes = true;
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Could not load the collection \"{collectionName}\" as individual collection for {identifier}, set to None.",
|
||||
"Load Failure",
|
||||
NotificationType.Warning);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -75,16 +75,14 @@ public partial class IndividualCollections
|
|||
if (!Add(group, collection))
|
||||
{
|
||||
changes = true;
|
||||
Penumbra.Chat.NotificationMessage($"Could not add an individual collection for {identifier}, removed.",
|
||||
"Load Failure",
|
||||
Penumbra.Messager.NotificationMessage($"Could not add an individual collection for {identifier}, removed.",
|
||||
NotificationType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
changes = true;
|
||||
Penumbra.Chat.NotificationMessage($"Could not load an unknown individual collection, removed:\n{e}", "Load Failure",
|
||||
NotificationType.Error);
|
||||
Penumbra.Messager.NotificationMessage(e, $"Could not load an unknown individual collection, removed.", NotificationType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -124,9 +122,9 @@ public partial class IndividualCollections
|
|||
if (Add($"{_actorService.AwaitedService.Data.ToName(kind, dataId)} ({kind.ToName()})", group, collection))
|
||||
Penumbra.Log.Information($"Migrated {name} ({kind.ToName()}) to NPC Identifiers [{ids}].");
|
||||
else
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Could not migrate {name} ({collection.AnonymizedName}) which was assumed to be a {kind.ToName()} with IDs [{ids}], please look through your individual collections.",
|
||||
"Migration Failure", NotificationType.Error);
|
||||
NotificationType.Error);
|
||||
}
|
||||
// If it is not a valid NPC name, check if it can be a player name.
|
||||
else if (ActorManager.VerifyPlayerName(name))
|
||||
|
|
@ -140,15 +138,15 @@ public partial class IndividualCollections
|
|||
}, collection))
|
||||
Penumbra.Log.Information($"Migrated {shortName} ({collection.AnonymizedName}) to Player Identifier.");
|
||||
else
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Could not migrate {shortName} ({collection.AnonymizedName}), please look through your individual collections.",
|
||||
"Migration Failure", NotificationType.Error);
|
||||
NotificationType.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Could not migrate {name} ({collection.AnonymizedName}), which can not be a player name nor is it a known NPC name, please look through your individual collections.",
|
||||
"Migration Failure", NotificationType.Error);
|
||||
NotificationType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Dalamud.Interface.Internal.Notifications;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Communication;
|
||||
using Penumbra.Mods.Manager;
|
||||
|
|
@ -143,14 +144,12 @@ public class InheritanceManager : IDisposable
|
|||
continue;
|
||||
|
||||
changes = true;
|
||||
Penumbra.Chat.NotificationMessage($"{collection.Name} can not inherit from {subCollection.Name}, removed.", "Warning",
|
||||
NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage($"{collection.Name} can not inherit from {subCollection.Name}, removed.", NotificationType.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
Penumbra.Chat.NotificationMessage(
|
||||
$"Inherited collection {subCollectionName} for {collection.AnonymizedName} does not exist, it was removed.", "Warning",
|
||||
NotificationType.Warning);
|
||||
Penumbra.Messager.NotificationMessage(
|
||||
$"Inherited collection {subCollectionName} for {collection.AnonymizedName} does not exist, it was removed.", NotificationType.Warning);
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue