Skip to content

Commit

Permalink
Merge pull request #122 from FFXIV-CombatReborn/mergeWIP2
Browse files Browse the repository at this point in the history
sync with vbm 0.0.0.160
  • Loading branch information
CarnifexOptimus authored Jun 6, 2024
2 parents 14b5617 + eb4bb34 commit 2e331cd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 11 deletions.
4 changes: 3 additions & 1 deletion BossMod/Debug/DebugParty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ public void DrawPartyDalamud()
ImGui.EndTable();
}

public unsafe void DrawPartyCustom()
public unsafe void DrawPartyCustom(bool secondary)
{
// note: alliance slots, unlike normal slots, are more permanent - if a player leaves, other players retain their indices (leaving gaps)
// also content ID for all alliance members always seems to be 0; this isn't a huge deal, since alliance members are always in the same zone and thus have valid object IDs
var gm = GroupManager.Instance();
if (secondary)
gm += 1;
var ui = UIState.Instance();
ImGui.TextUnformatted($"Num members: {gm->MemberCount}, alliance={(!gm->IsAlliance ? "no" : gm->IsSmallGroupAlliance ? "small-group" : "yes")}, has-helpers={ui->Buddy.DutyHelperInfo.HasHelpers}");

Expand Down
6 changes: 5 additions & 1 deletion BossMod/Debug/MainDebugWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public unsafe override void Draw()
}
if (ImGui.CollapsingHeader("Party (custom)"))
{
_debugParty.DrawPartyCustom();
_debugParty.DrawPartyCustom(false);
}
if (ImGui.CollapsingHeader("Party (duty recorder)"))
{
_debugParty.DrawPartyCustom(true);
}
if (ImGui.CollapsingHeader("Autorotation"))
{
Expand Down
17 changes: 16 additions & 1 deletion BossMod/Framework/WorldStateGameSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,24 @@ private unsafe void UpdateParty()
{
var gm = GroupManager.Instance();
var ui = UIState.Instance();
var pc = GameObjectManager.Instance()->Objects.IndexSorted[0].Value;
var pcContentId = UIState.Instance()->PlayerState.ContentId;
var pcEntityId = UIState.Instance()->PlayerState.EntityId;
if (Service.Condition[Dalamud.Game.ClientState.Conditions.ConditionFlag.DutyRecorderPlayback])
{
// when doing replay playback, game uses independent group manager
gm += 1;
pcEntityId = pc != null ? pc->EntityId : 0;
var member = pc != null ? gm->GetPartyMemberByObjectId(pcEntityId) : null;
pcContentId = member != null ? member->ContentId : 0;
}
else if (pc != null && pc->EntityId != pcEntityId)
{
Service.Log($"[WSG] Player entity id mismatch: {pcEntityId:X} vs {pc->EntityId:X}");
}

// update player slot
UpdatePartySlot(PartyState.PlayerSlot, UIState.Instance()->PlayerState.ContentId, UIState.Instance()->PlayerState.EntityId);
UpdatePartySlot(PartyState.PlayerSlot, pcContentId, pcEntityId);

// update normal party slots: first update/remove existing members, then add new ones
for (int i = PartyState.PlayerSlot + 1; i < PartyState.MaxPartySize; ++i)
Expand Down
11 changes: 4 additions & 7 deletions BossMod/Modules/Endwalker/Dungeon/D11LapisManalis/D111Albion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class WildlifeCrossing(BossModule module) : Components.GenericAOEs(module)
private static readonly Angle Rot90 = 90.Degrees();
private static readonly Angle RotM90 = -90.Degrees();

private Stampede stampede1 = Stampede.Default;
private Stampede stampede2 = Stampede.Default;
private Stampede stampede1;
private Stampede stampede2;

private static readonly (WPos, Angle)[] stampedePositions = [(new(4, -759), Rot90),
(new(44, -759), RotM90), (new(4, -749), Rot90), (new(44, -749), RotM90),
Expand Down Expand Up @@ -151,15 +151,12 @@ private void UpdateStampedeCount(ref Stampede stampede, float casterZ)
}
}

struct Stampede(bool active, WPos position, Angle rotation)
record struct Stampede(bool Active, WPos Position, Angle Rotation)
{
public bool Active = active;
public WPos Position = position;
public Angle Rotation = rotation;
public int Count = 0;
public DateTime Reset = default;
public List<Actor> Beasts = [];
public static readonly Stampede Default = new(false, new WPos(), new Angle());
public static readonly Stampede Default = new(false, default, default);
}

class IcyThroes(BossModule module) : Components.GenericBaitAway(module)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,16 @@ class Voidcleaver(BossModule module) : Components.RaidwideCast(module, ActionID.
class Lifescleaver(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.Lifescleaver2), new AOEShapeCone(50, 15.Degrees()));
class Tsunami(BossModule module) : Components.RaidwideAfterNPCYell(module, ActionID.MakeSpell(AID.Tsunami), (uint)NPCYell.LimitBreakStart, 4.5f);
class StygianDeluge(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.StygianDeluge));
class Antediluvian(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.Antediluvian2), new AOEShapeCircle(15));
class Antediluvian(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.Antediluvian2), new AOEShapeCircle(15))
{
public override void OnCastFinished(Actor caster, ActorCastInfo spell)
{
base.OnCastFinished(caster, spell);
if (NumCasts == 6 && (AID)spell.Action.ID == AID.Antediluvian2)
NumCasts = 0;
}
}

class BodySlam(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.BodySlam3), new AOEShapeCircle(8));
class BodySlamKB(BossModule module) : Components.KnockbackFromCastTarget(module, ActionID.MakeSpell(AID.BodySlam2), 10)
{
Expand Down
1 change: 1 addition & 0 deletions BossMod/Util/Hook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public bool Enabled
public HookAddress(Address address, T detour, bool autoEnable = true) : this(address.Value, detour, autoEnable) { }
public HookAddress(nint address, T detour, bool autoEnable = true)
{
Service.Log($"Hooking {typeof(T)} @ 0x{address:X}");
_hook = Service.Hook.HookFromAddress(address, detour);
if (autoEnable)
_hook.Enable();
Expand Down

0 comments on commit 2e331cd

Please sign in to comment.