AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
SpellClickInfo Struct Reference

#include "ObjectMgr.h"

Public Member Functions

bool IsFitToRequirements (Unit const *clicker, Unit const *clickee) const
 

Public Attributes

uint32 spellId
 
uint8 castFlags
 
SpellClickUserTypes userType
 

Detailed Description

Member Function Documentation

◆ IsFitToRequirements()

bool SpellClickInfo::IsFitToRequirements ( Unit const *  clicker,
Unit const *  clickee 
) const
265{
266 Player const* playerClicker = clicker->ToPlayer();
267 if (!playerClicker)
268 return true;
269
270 Unit const* summoner = nullptr;
271 // Check summoners for party
272 if (clickee->IsSummon())
273 summoner = clickee->ToTempSummon()->GetSummonerUnit();
274 if (!summoner)
275 summoner = clickee;
276
277 // This only applies to players
278 switch (userType)
279 {
281 if (!playerClicker->IsFriendlyTo(summoner))
282 return false;
283 break;
285 if (!playerClicker->IsInRaidWith(summoner))
286 return false;
287 break;
289 if (!playerClicker->IsInPartyWith(summoner))
290 return false;
291 break;
292 default:
293 break;
294 }
295
296 return true;
297}
@ SPELL_CLICK_USER_PARTY
Definition: SharedDefines.h:684
@ SPELL_CLICK_USER_RAID
Definition: SharedDefines.h:683
@ SPELL_CLICK_USER_FRIEND
Definition: SharedDefines.h:682
Unit * GetSummonerUnit() const
Definition: TemporarySummon.cpp:44
Player * ToPlayer()
Definition: Object.h:201
Definition: Player.h:1081
Definition: Unit.h:630
TempSummon * ToTempSummon()
Definition: Unit.h:696
bool IsInRaidWith(Unit const *unit) const
Definition: Unit.cpp:18797
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10241
bool IsInPartyWith(Unit const *unit) const
Definition: Unit.cpp:18774
SpellClickUserTypes userType
Definition: ObjectMgr.h:401

References TempSummon::GetSummonerUnit(), Unit::IsFriendlyTo(), Unit::IsInPartyWith(), Unit::IsInRaidWith(), Unit::IsSummon(), SPELL_CLICK_USER_FRIEND, SPELL_CLICK_USER_PARTY, SPELL_CLICK_USER_RAID, Object::ToPlayer(), Unit::ToTempSummon(), and userType.

Member Data Documentation

◆ castFlags

uint8 SpellClickInfo::castFlags

◆ spellId

uint32 SpellClickInfo::spellId

◆ userType

SpellClickUserTypes SpellClickInfo::userType

Referenced by IsFitToRequirements().