Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xanunderscore committed Jan 29, 2025
1 parent de433e1 commit cef92dd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions BossMod/Framework/ActionManagerEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public sealed unsafe class ActionManagerEx : IDisposable
private readonly HookAddress<ActionManager.Delegates.UseAction> _useActionHook;
private readonly HookAddress<ActionManager.Delegates.UseActionLocation> _useActionLocationHook;
private readonly HookAddress<PublicContentBozja.Delegates.UseFromHolster> _useBozjaFromHolsterDirectorHook;
private readonly HookAddress<InstanceContentDeepDungeon.Delegates.UsePomander> _usePomanderHook;
private readonly HookAddress<InstanceContentDeepDungeon.Delegates.UseStone> _useStoneHook;
private readonly HookAddress<ActionEffectHandler.Delegates.Receive> _processPacketActionEffectHook;
private readonly HookAddress<AutoAttackState.Delegates.SetImpl> _setAutoAttackStateHook;

Expand All @@ -88,6 +90,8 @@ public ActionManagerEx(WorldState ws, AIHints hints, MovementOverride movement)
_useActionHook = new(ActionManager.Addresses.UseAction, UseActionDetour);
_useActionLocationHook = new(ActionManager.Addresses.UseActionLocation, UseActionLocationDetour);
_useBozjaFromHolsterDirectorHook = new(PublicContentBozja.Addresses.UseFromHolster, UseBozjaFromHolsterDirectorDetour);
_usePomanderHook = new(InstanceContentDeepDungeon.Addresses.UsePomander, UsePomanderDetour);
_useStoneHook = new(InstanceContentDeepDungeon.Addresses.UseStone, UseStoneDetour);
_processPacketActionEffectHook = new(ActionEffectHandler.Addresses.Receive, ProcessPacketActionEffectDetour);
_setAutoAttackStateHook = new(AutoAttackState.Addresses.SetImpl, SetAutoAttackStateDetour);

Expand All @@ -100,6 +104,8 @@ public void Dispose()
{
_setAutoAttackStateHook.Dispose();
_processPacketActionEffectHook.Dispose();
_useStoneHook.Dispose();
_usePomanderHook.Dispose();
_useBozjaFromHolsterDirectorHook.Dispose();
_useActionLocationHook.Dispose();
_useActionHook.Dispose();
Expand Down Expand Up @@ -501,6 +507,17 @@ private bool UseBozjaFromHolsterDirectorDetour(PublicContentBozja* self, uint ho
return res;
}

// TODO add to manual q
private void UsePomanderDetour(InstanceContentDeepDungeon* self, uint slot)
{
_usePomanderHook.Original(self, slot);
}

private void UseStoneDetour(InstanceContentDeepDungeon* self, uint slot)
{
_useStoneHook.Original(self, slot);
}

private void ProcessPacketActionEffectDetour(uint casterID, Character* casterObj, Vector3* targetPos, ActionEffectHandler.Header* header, ActionEffectHandler.TargetEffects* effects, GameObjectId* targets)
{
// notify listeners about the event
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Global/DeepDungeon/AutoClear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public override void DrawExtra()

if (ImGui.Button("Set closest trap location as ignored"))
{
var pos = _trapsCurrentZone.MinBy(t => (t - player.Position).LengthSq()).Rounded(0.1f);
var pos = _trapsCurrentZone.Except(ProblematicTrapLocations).MinBy(t => (t - player.Position).LengthSq()).Rounded(0.1f);
ProblematicTrapLocations.Add(pos);
IgnoreTraps.Add(pos);
}
Expand Down

0 comments on commit cef92dd

Please sign in to comment.