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
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: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:198
Definition: Player.h:1064
Definition: Unit.h:630
TempSummon * ToTempSummon()
Definition: Unit.h:1730
bool IsInRaidWith(Unit const *unit) const
Definition: Unit.cpp:18762
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10210
bool IsInPartyWith(Unit const *unit) const
Definition: Unit.cpp:18739
SpellClickUserTypes userType
Definition: ObjectMgr.h:400

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