corrected comments and formatting to reflect Glamourer's main branch.

This commit is contained in:
Cordelia Mist 2025-01-17 18:09:10 -08:00
parent e1a41b5f3c
commit 8b609e5f05
9 changed files with 64 additions and 84 deletions

View file

@ -54,7 +54,7 @@ public class StateEditor(
return;
var actors = Applier.ChangeCustomize(state, settings.Source.RequiresChange());
Glamourer.Log.Information(
Glamourer.Log.Verbose(
$"Set {idx.ToDefaultName()} customizations in state {state.Identifier.Incognito(null)} from {old.Value} to {value.Value}. [Affecting {actors.ToLazyString("nothing")}.]");
StateChanged.Invoke(StateChangeType.Customize, settings.Source, state, actors, new CustomizeTransaction(idx, old, value));
}
@ -67,7 +67,7 @@ public class StateEditor(
return;
var actors = Applier.ChangeCustomize(state, settings.Source.RequiresChange());
Glamourer.Log.Information(
Glamourer.Log.Verbose(
$"Set {applied} customizations in state {state.Identifier.Incognito(null)} from {old} to {customizeInput}. [Affecting {actors.ToLazyString("nothing")}.]");
StateChanged.Invoke(StateChangeType.EntireCustomize, settings.Source, state, actors,
new EntireCustomizeTransaction(applied, old, customizeInput));
@ -78,10 +78,7 @@ public class StateEditor(
{
var state = (ActorState)data;
if (!Editor.ChangeItem(state, slot, item, settings.Source, out var old, settings.Key))
{
Glamourer.Log.Information("Not Setting State or invoking, Editor requested us not to change it!");
return;
}
var type = slot.ToIndex() < 10 ? StateChangeType.Equip : StateChangeType.Weapon;
var actors = type is StateChangeType.Equip
@ -92,8 +89,8 @@ public class StateEditor(
if (slot is EquipSlot.MainHand)
ApplyMainhandPeriphery(state, item, null, settings);
Glamourer.Log.Debug(
$"[ChangeItem] Set {slot.ToName()} in state {state.Identifier.Incognito(null)} from {old.Name} ({old.ItemId}) to {item.Name} ({item.ItemId}). [Affecting {actors.ToLazyString("nothing")}.]");
Glamourer.Log.Verbose(
$"Set {slot.ToName()} in state {state.Identifier.Incognito(null)} from {old.Name} ({old.ItemId}) to {item.Name} ({item.ItemId}). [Affecting {actors.ToLazyString("nothing")}.]");
if (type is StateChangeType.Equip)
{
@ -122,8 +119,8 @@ public class StateEditor(
return;
var actors = Applier.ChangeBonusItem(state, slot, settings.Source.RequiresChange());
Glamourer.Log.Debug(
$"[ChangeBonus] Set {slot.ToName()} in state {state.Identifier.Incognito(null)} from {old.Name} ({old.Id}) to {item.Name} ({item.Id}). [Affecting {actors.ToLazyString("nothing")}.]");
Glamourer.Log.Verbose(
$"Set {slot.ToName()} in state {state.Identifier.Incognito(null)} from {old.Name} ({old.Id}) to {item.Name} ({item.Id}). [Affecting {actors.ToLazyString("nothing")}.]");
StateChanged.Invoke(StateChangeType.BonusItem, settings.Source, state, actors, new BonusItemTransaction(slot, old, item));
}
@ -155,8 +152,8 @@ public class StateEditor(
if (slot is EquipSlot.MainHand)
ApplyMainhandPeriphery(state, item, stains, settings);
Glamourer.Log.Debug(
$"[ChangeEquip] Set {slot.ToName()} in state {state.Identifier.Incognito(null)} from {old.Name} ({old.ItemId}) to {item!.Value.Name} ({item.Value.ItemId}) and its stain from {oldStains} to {stains!.Value}. [Affecting {actors.ToLazyString("nothing")}.]");
Glamourer.Log.Verbose(
$"Set {slot.ToName()} in state {state.Identifier.Incognito(null)} from {old.Name} ({old.ItemId}) to {item!.Value.Name} ({item.Value.ItemId}) and its stain from {oldStains} to {stains!.Value}. [Affecting {actors.ToLazyString("nothing")}.]");
if (type is StateChangeType.Equip)
{
StateChanged.Invoke(type, settings.Source, state, actors, new EquipTransaction(slot, old, item!.Value));
@ -187,7 +184,7 @@ public class StateEditor(
return;
var actors = Applier.ChangeStain(state, slot, settings.Source.RequiresChange());
Glamourer.Log.Debug(
Glamourer.Log.Verbose(
$"Set {slot.ToName()} stain in state {state.Identifier.Incognito(null)} from {old} to {stains}. [Affecting {actors.ToLazyString("nothing")}.]");
StateChanged.Invoke(StateChangeType.Stains, settings.Source, state, actors, new StainTransaction(slot, old, stains));
}
@ -419,8 +416,8 @@ public class StateEditor(
var actors = settings.Source.RequiresChange()
? Applier.ApplyAll(state, requiresRedraw, false)
: ActorData.Invalid;
Glamourer.Log.Debug($"Applied design to {state.Identifier.Incognito(null)}. [Affecting {actors.ToLazyString("nothing")}.]");
Glamourer.Log.Verbose($"Applied design to {state.Identifier.Incognito(null)}. [Affecting {actors.ToLazyString("nothing")}.]");
StateChanged.Invoke(StateChangeType.Design, state.Sources[MetaIndex.Wetness], state, actors, null); // FIXME: maybe later
if(settings.SendStateUpdate)
StateUpdated.Invoke(StateUpdateType.DesignApplied, actors);

View file

@ -13,8 +13,8 @@ using Glamourer.GameData;
using Penumbra.GameData.DataContainers;
using Glamourer.Designs;
using Penumbra.GameData.Interop;
using ObjectManager = Glamourer.Interop.ObjectManager;
using Glamourer.Api.Enums;
using ObjectManager = Glamourer.Interop.ObjectManager;
namespace Glamourer.State;

View file

@ -274,7 +274,7 @@ public sealed class StateManager(
if (source is not StateSource.Game)
actors = Applier.ApplyAll(state, redraw, true);
Glamourer.Log.Debug(
Glamourer.Log.Verbose(
$"Reset entire state of {state.Identifier.Incognito(null)} to game base. [Affecting {actors.ToLazyString("nothing")}.]");
StateChanged.Invoke(StateChangeType.Reset, source, state, actors, null);
// only invoke if we define this reset call as the final call in our state update.
@ -302,7 +302,7 @@ public sealed class StateManager(
state.Materials.Clear();
Glamourer.Log.Debug(
Glamourer.Log.Verbose(
$"Reset advanced customization and dye state of {state.Identifier.Incognito(null)} to game base. [Affecting {actors.ToLazyString("nothing")}.]");
StateChanged.Invoke(StateChangeType.Reset, source, state, actors, null);
// Update that we have completed a full operation. (We can do this directly as nothing else is linked)
@ -453,22 +453,22 @@ public sealed class StateManager(
}
}
public void ReapplyState(Actor actor, bool forceRedraw, StateSource source, bool isUpdate = false)
public void ReapplyState(Actor actor, bool forceRedraw, StateSource source, bool stateUpdate = false)
{
if (!GetOrCreate(actor, out var state))
return;
ReapplyState(actor, state, forceRedraw, source, isUpdate);
ReapplyState(actor, state, forceRedraw, source, stateUpdate);
}
public void ReapplyState(Actor actor, ActorState state, bool forceRedraw, StateSource source, bool isUpdate)
public void ReapplyState(Actor actor, ActorState state, bool forceRedraw, StateSource source, bool stateUpdate)
{
var data = Applier.ApplyAll(state,
forceRedraw
|| !actor.Model.IsHuman
|| CustomizeArray.Compare(actor.Model.GetCustomize(), state.ModelData.Customize).RequiresRedraw(), false);
StateChanged.Invoke(StateChangeType.Reapply, source, state, data, null);
if(isUpdate)
if(stateUpdate)
StateUpdated.Invoke(StateUpdateType.Reapply, data);
}