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, 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(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, 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 public static readonly FunEquipSet AprilFirst = new

View file

@ -98,9 +98,17 @@ public unsafe class FunModule : IDisposable
if (actor.AsCharacter->CharacterData.ModelCharaId != 0) if (actor.AsCharacter->CharacterData.ModelCharaId != 0)
return; return;
if (_config.DisableFestivals == 0 && _festivalSet != null
|| _codes.EnabledWorld && actor.Index != 0)
{
armor = actor.Model.GetArmor(slot);
}
else
{
ApplyEmperor(new Span<CharacterArmor>(ref armor), slot); ApplyEmperor(new Span<CharacterArmor>(ref armor), slot);
ApplyClown(new Span<CharacterArmor>(ref armor)); ApplyClown(new Span<CharacterArmor>(ref armor));
} }
}
public void ApplyFun(Actor actor, Span<CharacterArmor> armor, ref Customize customize) public void ApplyFun(Actor actor, Span<CharacterArmor> armor, ref Customize customize)
{ {
@ -244,11 +252,12 @@ public unsafe class FunModule : IDisposable
try try
{ {
var tmp = _designManager.CreateTemporary(); var tmp = _designManager.CreateTemporary();
tmp.DesignData = _stateManager.FromActor(actor, true); tmp.DesignData = _stateManager.FromActor(actor, true, true);
tmp.FixCustomizeApplication(_customizations, CustomizeFlagExtensions.AllRelevant); tmp.FixCustomizeApplication(_customizations, CustomizeFlagExtensions.AllRelevant);
var data = _designConverter.ShareBase64(tmp); var data = _designConverter.ShareBase64(tmp);
ImGui.SetClipboardText(data); 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 catch
{ {

View file

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