mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Add fix for unimplemented but listed hairstyle.
This commit is contained in:
parent
9e7c5e9a89
commit
1a4bacf0b7
2 changed files with 75 additions and 50 deletions
|
|
@ -63,9 +63,14 @@ namespace Glamourer.Customization
|
|||
continue;
|
||||
|
||||
var hairRow = _customizeSheet.GetRow(customizeIdx);
|
||||
hairList.Add(hairRow != null
|
||||
? new Customization(CustomizationId.Hairstyle, hairRow.FeatureID, hairRow.Icon, (ushort) hairRow.RowId)
|
||||
: new Customization(CustomizationId.Hairstyle, (byte) i, customizeIdx, 0));
|
||||
if (hairRow == null)
|
||||
{
|
||||
hairList.Add(new Customization(CustomizationId.Hairstyle, (byte)i, customizeIdx));
|
||||
}
|
||||
else if (_icons.IconExists(hairRow.Icon))
|
||||
{
|
||||
hairList.Add(new Customization(CustomizationId.Hairstyle, hairRow.FeatureID, hairRow.Icon, (ushort)hairRow.RowId));
|
||||
}
|
||||
}
|
||||
|
||||
return hairList.ToArray();
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Utility;
|
||||
using ImGuiScene;
|
||||
using Lumina.Data.Files;
|
||||
|
||||
namespace Glamourer.Util
|
||||
{
|
||||
namespace Glamourer.Util;
|
||||
|
||||
public class IconStorage : IDisposable
|
||||
{
|
||||
private readonly DalamudPluginInterface _pi;
|
||||
|
|
@ -24,11 +25,17 @@ namespace Glamourer.Util
|
|||
public TextureWrap this[int id]
|
||||
=> LoadIcon(id);
|
||||
|
||||
private static string HqPath(uint id)
|
||||
=> $"ui/icon/{id / 1000 * 1000:000000}/{id:000000}_hr1.tex";
|
||||
|
||||
private static string NormalPath(uint id)
|
||||
=> $"ui/icon/{id / 1000 * 1000:000000}/{id:000000}.tex";
|
||||
|
||||
private TexFile? LoadIconHq(uint id)
|
||||
{
|
||||
var path = $"ui/icon/{id / 1000 * 1000:000000}/{id:000000}_hr1.tex";
|
||||
return _gameData.GetFile<TexFile>(path);
|
||||
}
|
||||
=> _gameData.GetFile<TexFile>(HqPath(id));
|
||||
|
||||
public bool IconExists(uint id)
|
||||
=> _gameData.FileExists(HqPath(id)) || _gameData.FileExists(NormalPath(id));
|
||||
|
||||
public TextureWrap LoadIcon(int id)
|
||||
=> LoadIcon((uint)id);
|
||||
|
|
@ -39,9 +46,23 @@ namespace Glamourer.Util
|
|||
return ret;
|
||||
|
||||
var icon = LoadIconHq(id) ?? _gameData.GetIcon(id)!;
|
||||
if (icon == null)
|
||||
{
|
||||
PluginLog.Warning($"No icon with id {id} could be found.");
|
||||
ret = _pi.UiBuilder.LoadImageRaw(new byte[]
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
}, 1, 1, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
var iconData = icon.GetRgbaImageData();
|
||||
|
||||
ret = _pi.UiBuilder.LoadImageRaw(iconData, icon.Header.Width, icon.Header.Height, 4);
|
||||
}
|
||||
|
||||
_icons[id] = ret;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -56,4 +77,3 @@ namespace Glamourer.Util
|
|||
~IconStorage()
|
||||
=> Dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue