AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
near_scarshield_infiltrator Class Reference
Inheritance diagram for near_scarshield_infiltrator:
AreaTriggerScript ScriptObject

Public Member Functions

 near_scarshield_infiltrator ()
 
bool OnTrigger (Player *player, const AreaTrigger *) override
 
- Public Member Functions inherited from AreaTriggerScript
bool IsDatabaseBound () const override
 
virtual bool OnTrigger (Player *, AreaTrigger const *)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Private Attributes

GuidList whisperedTargets
 

Additional Inherited Members

- Protected Member Functions inherited from AreaTriggerScript
 AreaTriggerScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ near_scarshield_infiltrator()

near_scarshield_infiltrator::near_scarshield_infiltrator ( )
inline
799: AreaTriggerScript("near_scarshield_infiltrator") { }
Definition: AreaTriggerScript.h:24

Member Function Documentation

◆ OnTrigger()

bool near_scarshield_infiltrator::OnTrigger ( Player player,
const AreaTrigger  
)
inlineoverridevirtual

Reimplemented from AreaTriggerScript.

802 {
803 if (player && player->IsAlive())
804 {
805 if (Creature* creature = player->FindNearestCreature(NPC_SCARSHIELD_INFILTRATOR, 100.0f, true))
806 {
807 bool transformHasStarted = creature->AI()->GetData(0) == 1;
808 if ((player->GetLevel() < 57 || !player->HasItemCount(ITEM_UNADORNED_SEAL)) && !transformHasStarted)
809 {
810 // Send whisper if not already sent
811 std::list<ObjectGuid>::iterator itr = std::find(whisperedTargets.begin(), whisperedTargets.end(), player->GetGUID());
812 if (itr == whisperedTargets.end())
813 {
814 creature->AI()->Talk(SAY_SCARSHIELD_INF_WHISPER, player);
815 whisperedTargets.push_back(player->GetGUID());
816 return true;
817 }
818 }
819 }
820 }
821 return false;
822 }
@ NPC_SCARSHIELD_INFILTRATOR
Definition: blackrock_spire.h:84
@ ITEM_UNADORNED_SEAL
Definition: blackrock_spire.h:106
@ SAY_SCARSHIELD_INF_WHISPER
Definition: instance_blackrock_spire.cpp:60
Definition: Creature.h:43
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2457
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
Definition: PlayerStorage.cpp:655
bool IsAlive() const
Definition: Unit.h:1654
uint8 GetLevel() const
Definition: Unit.h:1024
GuidList whisperedTargets
Definition: instance_blackrock_spire.cpp:824

References WorldObject::FindNearestCreature(), Object::GetGUID(), Unit::GetLevel(), Player::HasItemCount(), Unit::IsAlive(), ITEM_UNADORNED_SEAL, NPC_SCARSHIELD_INFILTRATOR, SAY_SCARSHIELD_INF_WHISPER, and whisperedTargets.

Member Data Documentation

◆ whisperedTargets

GuidList near_scarshield_infiltrator::whisperedTargets
private

Referenced by OnTrigger().