Fix FromActor using wrong hats for Who Am I?!!

This commit is contained in:
Ottermandias 2023-10-10 00:16:11 +02:00
parent bebab21919
commit 370d2ca84d
4 changed files with 20 additions and 10 deletions

View file

@ -77,7 +77,8 @@ internal class FunEquipSet
new Group(0000, 0, 0137, 1, 0000, 0, 0000, 0, 0000, 0), // Howling Spirit
new Group(0000, 0, 0137, 2, 0000, 0, 0000, 0, 0000, 0), // Wailing Spirit
new Group(0232, 1, 0232, 1, 0279, 1, 0232, 1, 0232, 1), // Eerie Attire
new Group(0232, 1, 6036, 1, 0279, 1, 0232, 1, 0232, 1) // Vampire
new Group(0232, 1, 6036, 1, 0279, 1, 0232, 1, 0232, 1), // Vampire
new Group(0505, 6, 0505, 6, 0505, 6, 0505, 6, 0505, 6) // Manusya Casting
);
public static readonly FunEquipSet AprilFirst = new

View file

@ -98,8 +98,16 @@ public unsafe class FunModule : IDisposable
if (actor.AsCharacter->CharacterData.ModelCharaId != 0)
return;
ApplyEmperor(new Span<CharacterArmor>(ref armor), slot);
ApplyClown(new Span<CharacterArmor>(ref armor));
if (_config.DisableFestivals == 0 && _festivalSet != null
|| _codes.EnabledWorld && actor.Index != 0)
{
armor = actor.Model.GetArmor(slot);
}
else
{
ApplyEmperor(new Span<CharacterArmor>(ref armor), slot);
ApplyClown(new Span<CharacterArmor>(ref armor));
}
}
public void ApplyFun(Actor actor, Span<CharacterArmor> armor, ref Customize customize)
@ -244,11 +252,12 @@ public unsafe class FunModule : IDisposable
try
{
var tmp = _designManager.CreateTemporary();
tmp.DesignData = _stateManager.FromActor(actor, true);
tmp.DesignData = _stateManager.FromActor(actor, true, true);
tmp.FixCustomizeApplication(_customizations, CustomizeFlagExtensions.AllRelevant);
var data = _designConverter.ShareBase64(tmp);
ImGui.SetClipboardText(data);
Glamourer.Messager.NotificationMessage($"Copied current actual design of {actor.Utf8Name} to clipboard.", NotificationType.Info, false);
Glamourer.Messager.NotificationMessage($"Copied current actual design of {actor.Utf8Name} to clipboard.", NotificationType.Info,
false);
}
catch
{

View file

@ -468,7 +468,7 @@ public class StateListener : IDisposable
// Always use the actor for the base data.
var isHuman = _humans.IsHuman(modelId);
if (isHuman)
state.BaseData = _manager.FromActor(actor, false);
state.BaseData = _manager.FromActor(actor, false, false);
else
state.BaseData.LoadNonHuman(modelId, *(Customize*)customizeData, equipData);

View file

@ -83,8 +83,8 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
// and the draw objects data for the model data (where possible).
state = new ActorState(identifier)
{
ModelData = FromActor(actor, true),
BaseData = FromActor(actor, false),
ModelData = FromActor(actor, true, false),
BaseData = FromActor(actor, false, false),
LastJob = (byte)(actor.IsCharacter ? actor.AsCharacter->CharacterData.ClassJob : 0),
LastTerritory = _clientState.TerritoryType,
};
@ -104,7 +104,7 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
/// This uses the draw object if available and where possible,
/// and the game object where necessary.
/// </summary>
public unsafe DesignData FromActor(Actor actor, bool useModel)
public unsafe DesignData FromActor(Actor actor, bool useModel, bool ignoreHatState)
{
var ret = new DesignData();
// If the given actor is not a character, just return a default character.
@ -143,7 +143,7 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
ret.Customize = model.GetCustomize();
// We can not use the head slot data from the draw object if the hat is hidden.
var head = ret.IsHatVisible() ? model.GetArmor(EquipSlot.Head) : actor.GetArmor(EquipSlot.Head);
var head = ret.IsHatVisible() || ignoreHatState ? model.GetArmor(EquipSlot.Head) : actor.GetArmor(EquipSlot.Head);
var headItem = _items.Identify(EquipSlot.Head, head.Set, head.Variant);
ret.SetItem(EquipSlot.Head, headItem);
ret.SetStain(EquipSlot.Head, head.Stain);