mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-20 22:47:45 +01:00
We have config at home.
This commit is contained in:
parent
d10cb3137f
commit
80ab57e96d
13 changed files with 487 additions and 62 deletions
|
|
@ -19,7 +19,7 @@ public class Design : ISavable
|
|||
|
||||
internal Design(ItemManager items)
|
||||
{
|
||||
SetDefaultEquipment(items);
|
||||
DesignData.SetDefaultEquipment(items);
|
||||
}
|
||||
|
||||
// Metadata
|
||||
|
|
@ -35,20 +35,6 @@ public class Design : ISavable
|
|||
|
||||
internal DesignData DesignData;
|
||||
|
||||
public void SetDefaultEquipment(ItemManager items)
|
||||
{
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
{
|
||||
DesignData.SetItem(slot, ItemManager.NothingItem(slot));
|
||||
DesignData.SetStain(slot, 0);
|
||||
}
|
||||
|
||||
DesignData.SetItem(EquipSlot.MainHand, items.DefaultSword);
|
||||
DesignData.SetStain(EquipSlot.MainHand, 0);
|
||||
DesignData.SetItem(EquipSlot.OffHand, ItemManager.NothingItem(FullEquipType.Shield));
|
||||
DesignData.SetStain(EquipSlot.OffHand, 0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Application Data
|
||||
|
|
@ -272,7 +258,7 @@ public class Design : ISavable
|
|||
{
|
||||
if (equip == null)
|
||||
{
|
||||
design.SetDefaultEquipment(items);
|
||||
design.DesignData.SetDefaultEquipment(items);
|
||||
Glamourer.Chat.NotificationMessage("The loaded design does not contain any equipment data, reset to default.", "Warning",
|
||||
NotificationType.Warning);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
|
||||
using Glamourer.Customization;
|
||||
using Glamourer.Services;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.String.Functions;
|
||||
using CustomizeData = Penumbra.GameData.Structs.CustomizeData;
|
||||
|
||||
namespace Glamourer.Designs;
|
||||
|
||||
|
|
@ -32,7 +37,7 @@ public unsafe struct DesignData
|
|||
private byte _states;
|
||||
|
||||
public DesignData()
|
||||
{}
|
||||
{ }
|
||||
|
||||
public readonly StainId Stain(EquipSlot slot)
|
||||
{
|
||||
|
|
@ -167,6 +172,53 @@ public unsafe struct DesignData
|
|||
return true;
|
||||
}
|
||||
|
||||
public void SetDefaultEquipment(ItemManager items)
|
||||
{
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
{
|
||||
SetItem(slot, ItemManager.NothingItem(slot));
|
||||
SetStain(slot, 0);
|
||||
}
|
||||
|
||||
SetItem(EquipSlot.MainHand, items.DefaultSword);
|
||||
SetStain(EquipSlot.MainHand, 0);
|
||||
SetItem(EquipSlot.OffHand, ItemManager.NothingItem(FullEquipType.Shield));
|
||||
SetStain(EquipSlot.OffHand, 0);
|
||||
}
|
||||
|
||||
public void LoadNonHuman(uint modelId, Customize customize, byte* equipData)
|
||||
{
|
||||
ModelId = modelId;
|
||||
Customize.Load(customize);
|
||||
fixed (byte* ptr = _equipmentBytes)
|
||||
{
|
||||
MemoryUtility.MemCpyUnchecked(ptr, equipData, 40);
|
||||
}
|
||||
}
|
||||
|
||||
public readonly byte[] GetCustomizeBytes()
|
||||
{
|
||||
var ret = new byte[CustomizeData.Size];
|
||||
fixed (byte* retPtr = ret, inPtr = Customize.Data.Data)
|
||||
{
|
||||
MemoryUtility.MemCpyUnchecked(retPtr, inPtr, ret.Length);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public readonly byte[] GetEquipmentBytes()
|
||||
{
|
||||
var ret = new byte[40];
|
||||
fixed (byte* retPtr = ret, inPtr = _equipmentBytes)
|
||||
{
|
||||
MemoryUtility.MemCpyUnchecked(retPtr, inPtr, ret.Length);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
private static bool SetIfDifferent<T>(ref T old, T value) where T : IEquatable<T>
|
||||
{
|
||||
|
|
@ -176,4 +228,4 @@ public unsafe struct DesignData
|
|||
old = value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue