Skip to content

Commit

Permalink
Fixed a bug with cancelled quest items & minor style fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
awgil committed Dec 30, 2024
1 parent f1290aa commit 928d62a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
7 changes: 5 additions & 2 deletions BossMod/ActionTweaks/CancelCastTweak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ private bool WantCancel()
return false;

var cast = _ws.Party.Player()?.CastInfo;
var target = _ws.Actors.Find(cast?.TargetID ?? 0);
if (cast == null || cast.Action.Type == ActionType.KeyItem) // don't auto cancel quest items, that's never a good idea
return false;

var target = _ws.Actors.Find(cast.TargetID);
if (target == null)
return false;

var isRaise = Service.LuminaRow<Lumina.Excel.Sheets.Action>(cast?.Action.SpellId() ?? 0)?.DeadTargetBehaviour == 1;
var isRaise = Service.LuminaRow<Lumina.Excel.Sheets.Action>(cast.Action.SpellId())?.DeadTargetBehaviour == 1;
if (!isRaise)
return target.IsDead;

Expand Down
5 changes: 1 addition & 4 deletions BossMod/Data/ActorState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,6 @@ public sealed record class OpEventNpcYell(ulong InstanceID, ushort Message) : Op
public sealed record class OpEventOpenTreasure(ulong InstanceID) : Operation(InstanceID)
{
protected override void ExecActor(WorldState ws, Actor actor) => ws.Actors.EventOpenTreasure.Fire(actor);
public override void Write(ReplayRecorder.Output output)
{
output.EmitFourCC("OPNT"u8).EmitActor(InstanceID);
}
public override void Write(ReplayRecorder.Output output) => output.EmitFourCC("OPNT"u8).EmitActor(InstanceID);
}
}
1 change: 1 addition & 0 deletions BossMod/Framework/WorldStateGameSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ private unsafe void ProcessPacketRSVDataDetour(byte* packet)
_processPacketRSVDataHook.Original(packet);
_globalOps.Add(new WorldState.OpRSVData(MemoryHelper.ReadStringNullTerminated((nint)(packet + 4)), MemoryHelper.ReadString((nint)(packet + 0x34), *(int*)packet)));
}

private unsafe void ProcessPacketOpenTreasureDetour(uint actorID, byte* packet)
{
_processPacketOpenTreasureHook.Original(actorID, packet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private IEnumerable<WPos> SafeSpots()
{
foreach (var a in safespots.Allowed(default))
{
var mid = ((a.Item1.Rad + a.Item2.Rad) * 0.5f).Radians();
var mid = ((a.min.Rad + a.max.Rad) * 0.5f).Radians();
yield return safespots.Center + safespots.Radius * mid.ToDirection();
}
}
Expand Down
1 change: 1 addition & 0 deletions BossMod/Replay/ReplayParserLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ private WorldState.OpEnvControl ParseEnvControl()
_input.ReadUInt(true);
return new(_input.ReadByte(true), _input.ReadUInt(true));
}

private WorldState.OpSystemLogMessage ParseSystemLog()
{
var id = _input.ReadUInt(false);
Expand Down

0 comments on commit 928d62a

Please sign in to comment.