mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 05:04:15 +01:00
Better attribution of authors in item swap.
This commit is contained in:
parent
1845c4b89b
commit
349241d0ab
2 changed files with 29 additions and 6 deletions
|
|
@ -30,12 +30,12 @@ public partial class ModCreator(
|
||||||
public readonly Configuration Config = config;
|
public readonly Configuration Config = config;
|
||||||
|
|
||||||
/// <summary> Creates directory and files necessary for a new mod without adding it to the manager. </summary>
|
/// <summary> Creates directory and files necessary for a new mod without adding it to the manager. </summary>
|
||||||
public DirectoryInfo? CreateEmptyMod(DirectoryInfo basePath, string newName, string description = "")
|
public DirectoryInfo? CreateEmptyMod(DirectoryInfo basePath, string newName, string description = "", string? author = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var newDir = CreateModFolder(basePath, newName, Config.ReplaceNonAsciiOnImport, true);
|
var newDir = CreateModFolder(basePath, newName, Config.ReplaceNonAsciiOnImport, true);
|
||||||
dataEditor.CreateMeta(newDir, newName, Config.DefaultModAuthor, description, "1.0", string.Empty);
|
dataEditor.CreateMeta(newDir, newName, author ?? Config.DefaultModAuthor, description, "1.0", string.Empty);
|
||||||
CreateDefaultFiles(newDir);
|
CreateDefaultFiles(newDir);
|
||||||
return newDir;
|
return newDir;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ using Penumbra.Communication;
|
||||||
using Penumbra.GameData.Data;
|
using Penumbra.GameData.Data;
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
using Penumbra.GameData.Structs;
|
using Penumbra.GameData.Structs;
|
||||||
|
using Penumbra.Import.Structs;
|
||||||
using Penumbra.Meta;
|
using Penumbra.Meta;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
using Penumbra.Mods.Groups;
|
using Penumbra.Mods.Groups;
|
||||||
|
|
@ -275,16 +276,38 @@ public class ItemSwapTab : IDisposable, ITab, IUiService
|
||||||
case SwapType.Hair:
|
case SwapType.Hair:
|
||||||
case SwapType.Tail:
|
case SwapType.Tail:
|
||||||
return
|
return
|
||||||
$"Created by swapping {_lastTab} {_sourceId} onto {_lastTab} {_targetId} for {_currentRace.ToName()} {_currentGender.ToName()}s in {_mod!.Name}.";
|
$"Created by swapping {_lastTab} {_sourceId} onto {_lastTab} {_targetId} for {_currentRace.ToName()} {_currentGender.ToName()}s in {_mod!.Name}{OriginalAuthor()}";
|
||||||
case SwapType.BetweenSlots:
|
case SwapType.BetweenSlots:
|
||||||
return
|
return
|
||||||
$"Created by swapping {GetAccessorySelector(_slotFrom, true).Item3.CurrentSelection.Item.Name} onto {GetAccessorySelector(_slotTo, false).Item3.CurrentSelection.Item.Name} in {_mod!.Name}.";
|
$"Created by swapping {GetAccessorySelector(_slotFrom, true).Item3.CurrentSelection.Item.Name} onto {GetAccessorySelector(_slotTo, false).Item3.CurrentSelection.Item.Name} in {_mod!.Name}{OriginalAuthor()}";
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
$"Created by swapping {_selectors[_lastTab].Source.CurrentSelection.Item.Name} onto {_selectors[_lastTab].Target.CurrentSelection.Item.Name} in {_mod!.Name}.";
|
$"Created by swapping {_selectors[_lastTab].Source.CurrentSelection.Item.Name} onto {_selectors[_lastTab].Target.CurrentSelection.Item.Name} in {_mod!.Name}{OriginalAuthor()}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string OriginalAuthor()
|
||||||
|
{
|
||||||
|
if (_mod!.Author.IsEmpty || _mod!.Author.Text is "TexTools User" or DefaultTexToolsData.Author)
|
||||||
|
return ".";
|
||||||
|
|
||||||
|
return $" by {_mod!.Author}.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private string CreateAuthor()
|
||||||
|
{
|
||||||
|
if (_mod!.Author.IsEmpty)
|
||||||
|
return _config.DefaultModAuthor;
|
||||||
|
if (_mod!.Author.Text == _config.DefaultModAuthor)
|
||||||
|
return _config.DefaultModAuthor;
|
||||||
|
if (_mod!.Author.Text is "TexTools User" or DefaultTexToolsData.Author)
|
||||||
|
return _config.DefaultModAuthor;
|
||||||
|
if (_config.DefaultModAuthor is DefaultTexToolsData.Author)
|
||||||
|
return _mod!.Author;
|
||||||
|
|
||||||
|
return $"{_mod!.Author} (Swap by {_config.DefaultModAuthor})";
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateOption()
|
private void UpdateOption()
|
||||||
{
|
{
|
||||||
_selectedGroup = _mod?.Groups.FirstOrDefault(g => g.Name == _newGroupName);
|
_selectedGroup = _mod?.Groups.FirstOrDefault(g => g.Name == _newGroupName);
|
||||||
|
|
@ -296,7 +319,7 @@ public class ItemSwapTab : IDisposable, ITab, IUiService
|
||||||
|
|
||||||
private void CreateMod()
|
private void CreateMod()
|
||||||
{
|
{
|
||||||
var newDir = _modManager.Creator.CreateEmptyMod(_modManager.BasePath, _newModName, CreateDescription());
|
var newDir = _modManager.Creator.CreateEmptyMod(_modManager.BasePath, _newModName, CreateDescription(), CreateAuthor());
|
||||||
if (newDir == null)
|
if (newDir == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue