AzeorthCore 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
263{
264 Player const* playerClicker = clicker->ToPlayer();
265 if (!playerClicker)
266 return true;
267
268 Unit const* summoner = nullptr;
269 // Check summoners for party
270 if (clickee->IsSummon())
271 summoner = clickee->ToTempSummon()->GetSummonerUnit();
272 if (!summoner)
273 summoner = clickee;
274
275 // This only applies to players
276 switch (userType)
277 {
279 if (!playerClicker->IsFriendlyTo(summoner))
280 return false;
281 break;
283 if (!playerClicker->IsInRaidWith(summoner))
284 return false;
285 break;
287 if (!playerClicker->IsInPartyWith(summoner))
288 return false;
289 break;
290 default:
291 break;
292 }
293
294 return true;
295}
@ SPELL_CLICK_USER_PARTY
Definition: SharedDefines.h:656
@ SPELL_CLICK_USER_RAID
Definition: SharedDefines.h:655
@ SPELL_CLICK_USER_FRIEND
Definition: SharedDefines.h:654
Unit * GetSummonerUnit() const
Definition: TemporarySummon.cpp:43
Player * ToPlayer()
Definition: Object.h:195
Definition: Player.h:1046
Definition: Unit.h:1290
TempSummon * ToTempSummon()
Definition: Unit.h:2668
bool IsInRaidWith(Unit const *unit) const
Definition: Unit.cpp:19685
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:11058
bool IsInPartyWith(Unit const *unit) const
Definition: Unit.cpp:19662
SpellClickUserTypes userType
Definition: ObjectMgr.h:402

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().