Skip to content

Commit daa055a

Browse files
authored
Merge pull request #746 from Xian55/fix/720
Addon: [1.9.3] - Fix dead soft target blocking combat with body-pulled mobs (#720)
2 parents 6d68bcc + 8cdc981 commit daa055a

16 files changed

Lines changed: 173 additions & 87 deletions

Addons/DataToColor/DataToColor.lua

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
-- Trigger between emitting game data and frame location data
66
local SETUP_SEQUENCE = false
77
-- Total number of data frames generated
8-
local NUMBER_OF_FRAMES = 111
8+
local NUMBER_OF_FRAMES = 112
99
-- Set number of pixel rows
1010
local FRAME_ROWS = 1
1111
-- Size of data squares in px. Varies based on rounding errors as well as dimension size. Use as a guideline, but not 100% accurate.
@@ -212,6 +212,7 @@ DataToColor.gcdExpirationTime = 0
212212

213213
DataToColor.lastAutoShot = 0
214214
DataToColor.lastMainHandMeleeSwing = 0
215+
DataToColor.lastDamageDoneTime = 0
215216
DataToColor.lastCastEvent = 0
216217
DataToColor.lastCastSpellId = 0
217218
DataToColor.lastCastGCD = 0
@@ -938,15 +939,6 @@ function DataToColor:CreateFrames()
938939

939940
Pixel(int, DataToColor.talentQueue:shift(globalTick) or 0, 72)
940941

941-
-- Key bindings queue (slot 106)
942-
Pixel(int, DataToColor.bindingQueue:shift(globalTick) or 0, 106)
943-
944-
-- Action bar texture queue (slot 107)
945-
Pixel(int, DataToColor.actionBarTextureQueue:shift(globalTick) or 0, 107)
946-
947-
-- Action bar macro queue (slot 108)
948-
Pixel(int, DataToColor.actionBarMacroQueue:shift(globalTick) or 0, 108)
949-
950942
local gossipNum = DataToColor.gossipQueue:shift(globalTick)
951943
if gossipNum then
952944
--DataToColor:Print("gossipQueue: ", gossipNum)
@@ -1146,6 +1138,18 @@ function DataToColor:CreateFrames()
11461138
Pixel(int, 0, 105)
11471139
end
11481140

1141+
1142+
-- Key bindings queue (slot 106)
1143+
Pixel(int, DataToColor.bindingQueue:shift(globalTick) or 0, 106)
1144+
1145+
-- Action bar texture queue (slot 107)
1146+
Pixel(int, DataToColor.actionBarTextureQueue:shift(globalTick) or 0, 107)
1147+
1148+
-- Action bar macro queue (slot 108)
1149+
Pixel(int, DataToColor.actionBarMacroQueue:shift(globalTick) or 0, 108)
1150+
1151+
Pixel(int, DataToColor.lastDamageDoneTime, 109)
1152+
11491153
UpdateGlobalTime()
11501154
-- NUMBER_OF_FRAMES - 1 reserved for validation
11511155

Addons/DataToColor/DataToColor.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Title: DataToColor
33
## Author: FreeHongKongMMO
44
## Notes: Displays data as colors (Legacy Cataclysm 4.3.0)
5-
## Version: 1.9.2
5+
## Version: 1.9.3
66
## RequiredDeps:
77
## OptionalDeps: Ace3, LibRangeCheck, cTimerBackport
88
## SavedVariables:

Addons/DataToColor/DataToColor_Classic.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Title: DataToColor
33
## Author: FreeHongKongMMO
44
## Notes: Displays data as colors (Classic)
5-
## Version: 1.9.2
5+
## Version: 1.9.3
66
## RequiredDeps:
77
## OptionalDeps: Ace3, LibRangeCheck, LibClassicCasterino
88
## SavedVariables:

Addons/DataToColor/DataToColor_TBC.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Title: DataToColor
33
## Author: FreeHongKongMMO
44
## Notes: Displays data as colors (Classic TBC)
5-
## Version: 1.9.2
5+
## Version: 1.9.3
66
## RequiredDeps:
77
## OptionalDeps: Ace3, LibRangeCheck, LibClassicCasterino
88
## SavedVariables:

Addons/DataToColor/EventHandlers.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ function DataToColor:OnCombatEvent(...)
471471
end
472472

473473
DataToColor.CombatDamageDoneQueue:push(DataToColor:getGuidFromUUID(destGUID))
474+
DataToColor.lastDamageDoneTime = DataToColor.globalTime
474475

475476
if playerDamageMiss[subEvent] then
476477
local missType = select(-2, ...)

Addons/DataToColor/SetupDefaultBindings.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ function DataToColor:SetEssentialBindings()
342342
wasChanged = TryBind("ALT-HOME", "INTERACTTARGET") or wasChanged
343343
wasChanged = TryBind("ALT-END", "INTERACTMOUSEOVER") or wasChanged
344344

345+
-- Combat: Start attack (bypasses soft target interaction)
346+
wasChanged = TryBind("ALT-NUMPADPLUS", "STARTATTACK") or wasChanged
347+
345348
-- Pet keys (only meaningful for pet classes)
346349
wasChanged = TryBind("NUMPADMULTIPLY", "TARGETPET") or wasChanged
347350
wasChanged = TryBind("NUMPADMINUS", "PETATTACK") or wasChanged

Core/Addon/PlayerReader.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,22 @@ public void Reset()
308308

309309
GCD.Reset();
310310
}
311+
312+
public bool IsMeleeSwingingDefault() => IsMeleeSwinging(500);
313+
314+
public bool IsMeleeSwinging(int extraMarginMs)
315+
{
316+
// Only relevant when in melee range
317+
if (!IsInMeleeRange())
318+
return false;
319+
320+
// Check if swing timer shows recent activity
321+
int swingSpeed = MainHandSpeedMs();
322+
int elapsed = MainHandSwing.ElapsedMs();
323+
324+
// Buffer: swing speed + network latency + 250ms margin
325+
int maxExpectedElapsed = swingSpeed + NetworkLatency + extraMarginMs;
326+
327+
return elapsed < maxExpectedElapsed;
328+
}
311329
}

Core/AddonComponent/AddonBits.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ public void Update(IAddonDataProvider reader)
110110

111111
public bool SoftInteract_Enabled() => v3[Mask._10];
112112

113+
public bool SoftInteract_CombatBlocker() =>
114+
SoftInteract() && (SoftInteract_Dead() || SoftInteract_Tagged());
115+
113116
public bool MailFrameShown() => v3[Mask._11];
114117

115118
public bool NotMailFrameShown() => !MailFrameShown();

Core/AddonComponent/CombatLog.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public sealed class CombatLog : IReader
3333
public RecordInt TargetMissType { get; }
3434
public RecordInt TargetDodge { get; }
3535

36+
public RecordInt LastDamageDoneTime { get; }
37+
3638
public CombatLog(AddonBits bits)
3739
{
3840
this.bits = bits;
@@ -41,6 +43,8 @@ public CombatLog(AddonBits bits)
4143
DamageTakenGuid = new RecordInt(65);
4244
DeadGuid = new RecordInt(66);
4345

46+
LastDamageDoneTime = new(109);
47+
4448
TargetMissType = new(67);
4549
TargetDodge = new(67);
4650
}
@@ -56,6 +60,8 @@ public void Reset()
5660
DamageTakenGuid.Reset();
5761
DeadGuid.Reset();
5862

63+
LastDamageDoneTime.Reset();
64+
5965
TargetMissType.Reset();
6066
TargetDodge.Reset();
6167
}
@@ -64,6 +70,8 @@ public void Update(IAddonDataProvider reader)
6470
{
6571
bool combat = bits.Combat();
6672

73+
LastDamageDoneTime.Update(reader);
74+
6775
if (combat && DamageTakenGuid.Updated(reader) && DamageTakenGuid.Value > 0)
6876
{
6977
DamageTaken.Add(DamageTakenGuid.Value);

Core/ClassConfig/ClassConfigurationBaseActions.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public sealed partial class ClassConfiguration
4141
public KeyAction AutoAttack { get; } = new()
4242
{
4343
Name = nameof(AutoAttack),
44-
BindingID = BindingID.INTERACTTARGET,
44+
BindingID = BindingID.STARTATTACK,
4545
BaseAction = true,
46-
Requirement = "!AutoAttacking && !SoftTargetDead"
46+
Requirement = "!AutoAttacking && !MeleeSwinging"
4747
};
4848

4949
public KeyAction TargetLastTarget { get; } = new()
@@ -133,4 +133,18 @@ public sealed partial class ClassConfiguration
133133
BaseAction = true,
134134
Cooldown = 6000,
135135
};
136+
137+
public KeyAction StrafeLeft { get; } = new()
138+
{
139+
Name = nameof(StrafeLeft),
140+
BindingID = BindingID.STRAFELEFT,
141+
BaseAction = true,
142+
};
143+
144+
public KeyAction StrafeRight { get; } = new()
145+
{
146+
Name = nameof(StrafeRight),
147+
BindingID = BindingID.STRAFERIGHT,
148+
BaseAction = true,
149+
};
136150
}

0 commit comments

Comments
 (0)