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

Public Member Functions

 achievement_save_the_day ()
 
bool OnCheck (Player *source, Unit *target, uint32) override
 
- Public Member Functions inherited from AchievementCriteriaScript
bool IsDatabaseBound () const override
 
virtual bool OnCheck (Player *, Unit *, uint32)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ achievement_save_the_day()

achievement_save_the_day::achievement_save_the_day ( )
inline
54: AchievementCriteriaScript("achievement_save_the_day") { }
Definition: AchievementCriteriaScript.h:24

Member Function Documentation

◆ OnCheck()

bool achievement_save_the_day::OnCheck ( Player source,
Unit target,
uint32   
)
inlineoverridevirtual

Reimplemented from AchievementCriteriaScript.

57 {
58 if (!target)
59 return false;
60
61 if (Player const* player = target->ToPlayer())
62 {
63 Battleground* bg = source->GetBattleground();
64 return bg && bg->GetBgTypeID(true) == BATTLEGROUND_WS && bg->ToBattlegroundWS()->GetFlagState(player->GetTeamId()) == BG_WS_FLAG_STATE_ON_BASE;
65 }
66 return false;
67 }
@ BATTLEGROUND_WS
Definition: SharedDefines.h:3482
@ BG_WS_FLAG_STATE_ON_BASE
Definition: BattlegroundWS.h:143
Definition: Battleground.h:303
BattlegroundWS * ToBattlegroundWS()
Definition: Battleground.h:587
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition: Battleground.h:329
uint8 GetFlagState(TeamId teamId) const
Definition: BattlegroundWS.h:235
Player * ToPlayer()
Definition: Object.h:201
Definition: Player.h:1081
Battleground * GetBattleground(bool create=false) const
Definition: Player.cpp:12228

References BATTLEGROUND_WS, BG_WS_FLAG_STATE_ON_BASE, Player::GetBattleground(), Battleground::GetBgTypeID(), BattlegroundWS::GetFlagState(), Battleground::ToBattlegroundWS(), and Object::ToPlayer().