mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
API 4 updates
This commit is contained in:
parent
86417ed74f
commit
f10280d15d
31 changed files with 359 additions and 367 deletions
|
|
@ -1,73 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Plugin;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
||||
namespace Glamourer
|
||||
{
|
||||
public static class GameData
|
||||
{
|
||||
private static Dictionary<byte, Stain>? _stains;
|
||||
private static Dictionary<EquipSlot, List<Item>>? _itemsBySlot;
|
||||
|
||||
public static IReadOnlyDictionary<byte, Stain> Stains(DalamudPluginInterface pi)
|
||||
{
|
||||
if (_stains != null)
|
||||
return _stains;
|
||||
|
||||
var sheet = pi.Data.GetExcelSheet<Lumina.Excel.GeneratedSheets.Stain>();
|
||||
_stains = sheet.Where(s => s.Color != 0).ToDictionary(s => (byte) s.RowId, s => new Stain((byte) s.RowId, s));
|
||||
return _stains;
|
||||
}
|
||||
|
||||
public static IReadOnlyDictionary<EquipSlot, List<Item>> ItemsBySlot(DalamudPluginInterface pi)
|
||||
{
|
||||
if (_itemsBySlot != null)
|
||||
return _itemsBySlot;
|
||||
|
||||
var sheet = pi.Data.GetExcelSheet<Lumina.Excel.GeneratedSheets.Item>();
|
||||
|
||||
Item EmptySlot(EquipSlot slot)
|
||||
=> new(sheet.First(), "Nothing", slot);
|
||||
|
||||
_itemsBySlot = new Dictionary<EquipSlot, List<Item>>()
|
||||
{
|
||||
[EquipSlot.Head] = new(200) { EmptySlot(EquipSlot.Head) },
|
||||
[EquipSlot.Body] = new(200) { EmptySlot(EquipSlot.Body) },
|
||||
[EquipSlot.Hands] = new(200) { EmptySlot(EquipSlot.Hands) },
|
||||
[EquipSlot.Legs] = new(200) { EmptySlot(EquipSlot.Legs) },
|
||||
[EquipSlot.Feet] = new(200) { EmptySlot(EquipSlot.Feet) },
|
||||
[EquipSlot.RFinger] = new(200) { EmptySlot(EquipSlot.RFinger) },
|
||||
[EquipSlot.Neck] = new(200) { EmptySlot(EquipSlot.Neck) },
|
||||
[EquipSlot.MainHand] = new(200) { EmptySlot(EquipSlot.MainHand) },
|
||||
[EquipSlot.OffHand] = new(200) { EmptySlot(EquipSlot.OffHand) },
|
||||
[EquipSlot.Wrists] = new(200) { EmptySlot(EquipSlot.Wrists) },
|
||||
[EquipSlot.Ears] = new(200) { EmptySlot(EquipSlot.Ears) },
|
||||
};
|
||||
|
||||
foreach (var item in sheet)
|
||||
{
|
||||
var name = item.Name.ToString();
|
||||
if (!name.Any())
|
||||
continue;
|
||||
|
||||
var slot = (EquipSlot) item.EquipSlotCategory.Row;
|
||||
if (slot == EquipSlot.Unknown)
|
||||
continue;
|
||||
|
||||
slot = slot.ToSlot();
|
||||
if (!_itemsBySlot.TryGetValue(slot, out var list))
|
||||
continue;
|
||||
|
||||
list.Add(new Item(item, name, slot));
|
||||
}
|
||||
|
||||
foreach (var list in _itemsBySlot.Values)
|
||||
list.Sort((i1, i2) => string.Compare(i1.Name, i2.Name, StringComparison.InvariantCulture));
|
||||
|
||||
_itemsBySlot[EquipSlot.LFinger] = _itemsBySlot[EquipSlot.RFinger];
|
||||
return _itemsBySlot;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue