Skip to content

Combustion / Improvements in MODIFY SCALE#21

Closed
Ramusik wants to merge 4 commits into
TrinityCore:masterfrom
Ramusik:master
Closed

Combustion / Improvements in MODIFY SCALE#21
Ramusik wants to merge 4 commits into
TrinityCore:masterfrom
Ramusik:master

Conversation

@Ramusik

@Ramusik Ramusik commented Mar 21, 2011

Copy link
Copy Markdown
Contributor

No description provided.

@unspike

unspike commented Mar 22, 2011

Copy link
Copy Markdown

Combustion bug!
If I have an aura of Combustion and if I gather a group of mobs (more than 5) and use the AoE spell, I get an aura with 6 stack and then aura will not be dispelled from a critical spell.

add this code to unit.cpp
case 11129:
{
*handled = true;
Unit *caster = triggeredByAura->GetCaster();
if (!caster || !damage)
return false;

  •       Aura \* pAura = GetAura(28682);
    
  •       if (pAura->GetStackAmount()==10)
    
  •           RemoveAurasDueToSpell(28682);
    

@luisalvarado

Copy link
Copy Markdown

Very nice the modify scale for creatures. +1

@Ramusik Ramusik closed this Apr 10, 2011
AlexTheBest pushed a commit to AlexTheBest/TrinityCore that referenced this pull request Jun 29, 2012
kamoulox pushed a commit to MobaTwink/MobaCore that referenced this pull request Nov 21, 2012
ike3 referenced this pull request in ike3/mangosbot Aug 25, 2014
remove trailing whitespace after 11831
Aokromes referenced this pull request in TrinityCoreLegacy/TrinityCore Sep 11, 2015
mynew4 referenced this pull request Oct 4, 2015
Implemented:
  ca83e14
  ee1c1b9
  18e4ab6
  bf37446
  cb854a2

* This adds separate (per map) guid sequences depending on object type
* Ported map object container from cmangos/mangos-wotlk@a2d396e
* Added type container visitor for TypeUnorderedMapContainer
* Implemented helper function to erase unique pairs from multimap containers
* Moved object storage of all objects except players and transports to map level
* Added containers linking database spawn id with creature/gameobject in world
* Renamed DBTableGuid to spawnId
* Added a separate spawn id sequence generator for creatures and gameobjects - this will be used in db tables
* Moved building SMSG_UPDATE_OBJECT - updatefields changes broadcast to map update
* Added new function to return but not increment guid
* Adjusted .debug loadcells to show low guid in map before/after load
* Added debug messages for creature spawn/destroy, for map guid debugging
* Store all Gameobjects and Creatures added to OutdoorPvP, so the callback script can be removed when OutdoorPvP instance is destroyed.
@mynew4 mynew4 mentioned this pull request Oct 5, 2015
@mynew4 mynew4 mentioned this pull request Dec 28, 2015
@tje3d tje3d mentioned this pull request Mar 13, 2018
MysterioPRM pushed a commit to MysterioPRM/TrinityCore that referenced this pull request Mar 15, 2021
xuehyc referenced this pull request in xuehyc/XCore Jan 24, 2023
vixalie pushed a commit to vixalie/TrinityCore that referenced this pull request Jan 27, 2024
T1ti pushed a commit to T1ti/TrinityCore that referenced this pull request Jul 31, 2025
…t being attacked, up from 5 seconds. (TrinityCore#21)

Training dummies with max health higher than 1 (Heroic Training Dummy) can now be damaged down to 1 hp and now regenerate health once they leave combat with all targets.
agatho referenced this pull request in agatho/TrinityCore Oct 5, 2025
…mination

CRITICAL FIX: Following CLAUDE.md - Code smell eliminated + deadlock resolved

ROOT CAUSE IDENTIFIED:
Deadlock occurred during BotAI constructor when bot joins group:
```
BotSession creates BotAI
  → BotAI::BotAI() constructor line 85
    → OnGroupJoined()
      → LeaderFollowBehavior::OnActivate() line 205
        → ObjectAccessor::FindPlayer(leaderGuid) → DEADLOCK!
```

This happens BEFORE first UpdateAI() call, so ObjectCache hasn't been initialized.
If any other thread is using ObjectAccessor at that moment → recursive lock → DEADLOCK.

CODE SMELL FIXED:
UpdateFollowTarget() was looking up the BOT via ObjectAccessor::FindPlayer(),
even though the bot pointer was already available from the calling context.

SOLUTION - Multiple ObjectAccessor eliminations:

1. **OnActivate() line 205** - CRITICAL FIX:
   BEFORE: ObjectAccessor::FindPlayer(leaderGuid) then fallback to group iteration
   AFTER: Direct group iteration only (works for all players including bots)

2. **UpdateFollowTarget()** - CODE SMELL FIX:
   BEFORE: void UpdateFollowTarget(Player* leader)
           Player* bot = ObjectAccessor::FindPlayer(_followTarget.guid)
   AFTER: void UpdateFollowTarget(Player* bot, Player* leader)
          Bot passed as parameter from calling context

3. **HandleLostLeader() line 943** - CONSISTENCY FIX:
   BEFORE: if (Player* leader = ObjectAccessor::FindPlayer(_followTarget.guid))
   AFTER: if (_followTarget.player)  // Already cached

4. **Lost leader teleport line 963** - CONSISTENCY FIX:
   BEFORE: if (Player* leader = ObjectAccessor::FindPlayer(_followTarget.guid))
   AFTER: if (_followTarget.player)  // Already cached

FILES MODIFIED:
  - src/modules/Playerbot/Movement/LeaderFollowBehavior.h
    * Updated UpdateFollowTarget signature to take both bot and leader

  - src/modules/Playerbot/Movement/LeaderFollowBehavior.cpp
    * Eliminated ALL 4 ObjectAccessor calls (lines 205, 626, 943, 963)
    * Fixed UpdateFollowTarget to use passed bot parameter
    * Updated call site to pass bot parameter

COMPLIANCE WITH CLAUDE.MD:
✓ Module-only implementation
✓ No core modifications
✓ Complete solution (no TODOs)
✓ Fixed code smell (unnecessary ObjectAccessor lookups)
✓ Performance improvement (4 fewer ObjectAccessor calls per follow update)
✓ Used existing data (_followTarget.player, group members iteration)

EXPECTED RESULT:
Zero ObjectAccessor calls in LeaderFollowBehavior during bot initialization.
Combined with Fix #19 (ObjectCache) and Fix #20 (ClassAI), this eliminates
ALL ObjectAccessor deadlock sources in the critical initialization path.

BUILD STATUS:
✓ Compiled successfully
✓ Deployed to M:/Wplayerbot/worldserver.exe

TESTING:
Monitor for deadlock during "Created ShamanAI" / group join initialization.
Expected: Zero "resource deadlock would occur" during bot group activation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants