Skip to content

Addon: [1.12.1] - Pet pull: register the pet's opener and detect a pet that cannot pull - #829

Merged
Xian55 merged 10 commits into
devfrom
feat/pet-pull
Aug 10, 2026
Merged

Xian55 merged 10 commits into
devfrom
feat/pet-pull

Conversation

@Xian55

@Xian55 Xian55 commented Aug 10, 2026 •

Copy link
Copy Markdown
Owner

Problem

A pet-led pull did not register. After the pet landed its opener the player was still not flagged as being in combat, so the bot sat on the target doing nothing until the mob walked over and swung — often 6-8 seconds later, and frequently long enough for PullTargetGoal's MAX_PULL_DURATION to expire, clear the target and turn away.

A second failure sat behind it: once the pet ran out of power it stopped attacking entirely. A pet with nothing to cast stands where it is rather than closing to melee, so the pull never happened at all and the bot waited out the full pull timer every time.

Root cause

Two independent bugs, both in the addon's combat log handling and both invisible from outside.

Pet damage never reached the bot. EventHandlers.lua gated the damage-done branch on playerPetSummons[sourceGUID]. That table is only ever filled by a live SPELL_SUMMON row and is emptied on every reinit, so a pet that was already out when the addon loaded — login, /reload, a loading screen, or attaching the bot to a running session — was not in it and every point of its damage was discarded. The damage-taken branch immediately above already had the petGUID fallback; the done branch did not.

Measured on a live pull:

00:14:34:138  New Plan= Pull Target
00:14:35..41  !PetEngaged ... dmgDone=0 dmgTaken=0 targetCombat=False playerCombat=False   (x7s)
00:14:37:110  StuckDetector Unstuck attempt 1: jump
00:14:42:072  DamageDone += guid=45150 | playerCombat=False    <- pet regened and fired

The player's combat flag is the wrong question. From Wrath on, UnitAffectingCombat("player") only turns true once the mob reaches the player and swings. GoapKey.incombat and .pulled both came from it, so CombatGoal could not run while the pet was already fighting.

Changes

Addon — Addons/DataToColor (version 1.12.0 → 1.12.1)

  • EventHandlers.lua: the pet damage-done branch now falls back to DataToColor.petGUID, mirroring the damage-taken branch. Kill credit is registered there too — without it a mob the pet killed on its own was never queued by unitDied and its corpse was never reported lootable.
  • Query.lua / BitCache.lua: new bits3 bit 18, "the pet can still afford a costed attack". Slot costs are cached on PET_BAR_UPDATE; only the UnitPower comparison is polled, and with no pet it costs nothing.

Core

  • CombatLog.PetEngaged — the pet holds a live mob that blows have already been traded with. GoapKey.incombat and .pulled now come from PlayerOrPetCombat().
  • Damage recording widened from the player's combat flag to "a pet is out". Not a floodgate: the addon only pushes rows whose source or destination is the player or one of its summons.
  • New PetCanPull requirement over the new bit.
  • The user-facing InCombat requirement deliberately stays bound to the raw player flag, so no existing profile changes meaning.

Profiles

  • Warlock 1-10 — the pet pull is gated on PetCanPull, and Immolate / Shadow Bolt take the opener back with "!Has Pet || !PetCanPull".
  • Hunter 1-10 — gains the same PetCanPull-gated pet pull, shaped after Hunter_66_farm_pet_pull. Also two backpedal entries built entirely from existing KeyAction machinery: with a pet, back out of melee while the pet tanks; without one, kite between shots.

Paths

  • 1-8_NightElf_Teldrassil.json — a night-elf Bloodfeather wander route in The Oracle Glade, capped at level 11 like the other blocks in the file. Unrelated to the pet work, included here for convenience.

Design notes

Why cost, and not the two obvious alternatives. Both were measured on 3.4.x and both are dead ends. GetPetActionSlotUsable returns true for every slot including PET_ACTION_FOLLOW and PET_MODE_PASSIVE, and stays true for Firebolt while the Imp is far too dry to cast it. autoCastAllowed does not separate them either — Blood Pact (6307) reports it exactly like Firebolt (3110). What actually differs is that Blood Pact is free. This is written up in Query.lua:GetPetActionSpellCost so it is not rediscovered the hard way.

Focus and mana share one path. Costs resolve through the existing GetSpellPowerCost abstraction and compare against UnitPower(pet, type), so a hunter pet's focus needs no special casing.

Target_Combat was tried and rejected. It looks like the natural signal — the mob's own combat flag, event-driven off UNIT_FLAGS — but it stayed false for every second of a live pet pull and never once beat the combat log to the answer. Noted in the PetEngaged doc comment.

Merged Approach entry in the hunter Pull. PullTargetGoal keeps a single Approach key per sequence (PullTargetGoal.cs:82-86, last-wins) and skips every Approach-named key in the cast loop, so a second entry of that name is silently shadowed. Both jobs live in one entry's requirements instead.

No new C# for the backpedals. PressDuration holds the key and Interrupt is a keep-going condition, so the press is cut short the moment it stops applying. BeforeCastFaceTarget aims first where the retreat direction matters.

Testing

Warlock 1-10 and Hunter 1-10 in Coldridge Valley / Northshire on Wrath 3.4.x. Pet pulls now register on the pet's first landed hit rather than on the mob's first melee swing; the player takes the opener back when the pet runs dry. Full solution builds clean in Release; luac -p clean on every touched Lua file.

Upgrade note

The in-game addon must be updated — the Core changes depend on bits3 bit 18 and on the repaired pet damage rows. An out-of-date addon reports bit 18 as 0, which reads as "the pet cannot pull" and disables the pet-pull branch in any profile using it. Both Warlock_1_10 and Hunter_1-10 fall back to the player's own opener in that case rather than stalling.

🤖 Generated with Claude Code

Xian55 and others added 9 commits August 11, 2026 01:27
The damage-done branch gated pet combat log rows on playerPetSummons, which is
only ever filled by a live SPELL_SUMMON row and is emptied on every reinit. A
pet that was already out when the addon loaded - login, /reload, a loading
screen, or attaching the bot to a running session - is therefore not in it, and
every point of its damage was dropped before it could reach cell 64.

Measured on a live pull: six and a half seconds of the pet fighting with
dmgDone=0 dmgTaken=0, and the first row arriving only once the mob reached the
player and the player's own combat flag flipped.

The damage-taken branch above already had the petGUID fallback; give the
done branch the same one. Register kill credit there too, otherwise a mob the
pet killed on its own is never queued by unitDied and its corpse is never
reported as lootable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
From Wrath on, UnitAffectingCombat("player") only turns true once the mob
reaches the player and swings, so a pull the pet won seconds ago reads as "not
fighting". CombatGoal could not run, PullTargetGoal kept pressing Approach, and
at MAX_PULL_DURATION the whole pull was thrown away - clear target, turn away,
walk off.

CombatLog.PetEngaged answers the question the player's combat flag cannot: the
pet holds a live mob that blows have already been traded with. Landed damage is
the earliest honest proof - pet target alone is set by PetAttack while the pet
is still running, and ToPull is filled the moment PullTargetGoal has a target.
DamageTaken carries the mirror case, a mob that aggroes the pet first.

Recording is widened from the player's combat flag to "a pet is out", which is
what let the opener through in the first place. Not a floodgate: the addon only
pushes rows whose source or destination is the player or one of its summons.

GoapKey.incombat and .pulled now come from PlayerOrPetCombat. The user facing
InCombat requirement deliberately stays bound to the raw player flag.

Target_Combat looks like it should work here and does not - it stayed false for
every second of a live pet pull, so it never once beat the combat log to the
answer. Noted in the doc comment so it is not tried again.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Pull the pet cannot make: an Imp out of mana for Firebolt stands where it is
rather than closing to melee, so handing it the pull stalls until the pull timer
gives up. bits3 bit 18 answers whether the pet has the power for a costed spell.

Cost is the discriminator, and both obvious alternatives were measured on 3.4.x
and both are dead. GetPetActionSlotUsable answers true for every slot,
PET_ACTION_FOLLOW included, and stays true for Firebolt while the Imp is far too
dry to cast it. autoCastAllowed does not separate them either - Blood Pact
(6307) reports it exactly like Firebolt (3110). What differs is that Blood Pact
is free.

Costs are resolved through the existing GetSpellPowerCost abstraction, so a
hunter pet's focus goes down the same path as a warlock pet's mana. The slot
scan is cached on PET_BAR_UPDATE and only the UnitPower comparison is polled;
with no pet it costs nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reads bits3 bit 18. Lets a profile hand the pull to the pet only while the pet
can actually make it, and take the opener back when it cannot.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Warlock 1-10 gates the pet pull on PetCanPull and gives Immolate and Shadow Bolt
"!Has Pet || !PetCanPull", so the player takes the opener back when the Imp runs
dry instead of waiting out the pull timer.

Hunter 1-10 gains the same pet pull, shaped after Hunter_66_farm_pet_pull: the
pet makes it and the hunter holds its shots so aggro starts on the pet. The two
Approach jobs are merged into one entry on purpose - PullTargetGoal keeps a
single Approach key per sequence, so a second entry of that name is silently
shadowed.

Both hunter retreats use the existing KeyAction machinery rather than anything
new. Interrupt is a keep-going condition, so a held backpedal is cut short the
moment it stops applying:

  with a pet, TargetsPet and InMeleeRange - the pet has the mob, so standing in
  its reach only costs health and blocks shooting. BeforeCastFaceTarget aims
  first, since backpedalling is relative to facing.

  without one, TargetsMe just after a shot - kite it, and stop 500ms before the
  next shot is due so the reload animation is not clipped.

The two are mutually exclusive by their pet, aggro and range gates.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Pull entries had been left gated on plain "Has Pet", which promised a pet
pull the pet may not be able to make - out of focus it stands still rather than
closing, and the pull stalls until the timer gives up. The file's own comments
already described the PetCanPull behaviour, so code and comments disagreed.

Now the same shape as Warlock_1_10: the pet branch needs PetCanPull, and Serpent
Sting and Auto Shot take the opener back with "!Has Pet || !PetCanPull".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Night elf specific, capped at level 11 like the other blocks in this file.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Xian55 Xian55 added documentation Improvements or additions to documentation bugfix This pull request fixes an issue. refactor This ticket concerns the possible simplification of code/data. enhancement This pull request implements a new feature. ai Artificial Intelligence tool has been contributed. labels Aug 10, 2026
LogPruned and LogLoopPeaks took the focus as a string, so the call sites had to
evaluate settings.Focus.ToString() before the source-generated method could
apply its own IsEnabled guard - which is exactly what the analyser flags.

Taking RouteFocus directly moves the conversion inside that guard. Core is now
clean in Release.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Xian55
Xian55 merged commit 1b49ad3 into dev Aug 10, 2026
1 check passed
@Xian55
Xian55 deleted the feat/pet-pull branch August 10, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Artificial Intelligence tool has been contributed. bugfix This pull request fixes an issue. documentation Improvements or additions to documentation enhancement This pull request implements a new feature. refactor This ticket concerns the possible simplification of code/data.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant