Jump to content

Removing someone from threatlist


Guest lillecarl
 Share

Recommended Posts

Hey guys, im just looking for a way to remove a player from a creatures threatlist (remove not zero his threat) I'm using this iteration and would like to clear the player if he meets a few contidions.

           ThreatList const& tList = m_creature->getThreatManager().getThreatList();
           for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr)

EDIT: Here is the entire code block:

           ThreatList const& tList = m_creature->getThreatManager().getThreatList();
           for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr)
           {
               pTarget = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid());
               Player *pPlayer = pTarget->ToPlayer();
               if (say_timer >= 120000)
               {
                   say_timer = 0;
                   ChatHandler(pPlayer).PSendSysMessage("%s[Training Dummy]%s To leave combat, move 25 yards from the dummy!",MSG_COLOR_MAGENTA,MSG_COLOR_WHITE);
               }

               if (pTarget && !pTarget->IsWithinDistInMap(m_creature,25,false) || !pTarget->IsWithinLOSInMap(m_creature))
               {
                   if (pPlayer)
                   {
                       ChatHandler(pPlayer).PSendSysMessage("%s[Training Dummy%s Now you left combat!",MSG_COLOR_MAGENTA,MSG_COLOR_WHITE);
                       pPlayer->ClearInCombat();
                       pPlayer->CombatStop(true);
                       pPlayer->CombatStopWithPets(true);
                   }
               }


               pTarget = NULL;
           }

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use