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

Public Member Functions

 honor_commandscript ()
 
ChatCommandTable GetCommands () const override
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Static Public Member Functions

static bool HandleHonorAddCommand (ChatHandler *handler, uint32 amount)
 
static bool HandleHonorAddKillCommand (ChatHandler *handler)
 
static bool HandleHonorUpdateCommand (ChatHandler *handler)
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ honor_commandscript()

honor_commandscript::honor_commandscript ( )
inline
28: CommandScript("honor_commandscript") { }
Definition CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable honor_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

31 {
32 static ChatCommandTable honorAddCommandTable =
33 {
34 { "kill", HandleHonorAddKillCommand, SEC_GAMEMASTER, Console::No },
35 { "", HandleHonorAddCommand, SEC_GAMEMASTER, Console::No }
36 };
37
38 static ChatCommandTable honorCommandTable =
39 {
40 { "add", honorAddCommandTable },
41 { "update", HandleHonorUpdateCommand, SEC_GAMEMASTER, Console::No }
42 };
43
44 static ChatCommandTable commandTable =
45 {
46 { "honor", honorCommandTable }
47 };
48 return commandTable;
49 }
@ SEC_GAMEMASTER
Definition Common.h:59
static bool HandleHonorAddCommand(ChatHandler *handler, uint32 amount)
Definition cs_honor.cpp:51
static bool HandleHonorUpdateCommand(ChatHandler *handler)
Definition cs_honor.cpp:86
static bool HandleHonorAddKillCommand(ChatHandler *handler)
Definition cs_honor.cpp:68
std::vector< ChatCommandBuilder > ChatCommandTable
Definition ChatCommand.h:46

References HandleHonorAddCommand(), HandleHonorAddKillCommand(), HandleHonorUpdateCommand(), and SEC_GAMEMASTER.

◆ HandleHonorAddCommand()

static bool honor_commandscript::HandleHonorAddCommand ( ChatHandler handler,
uint32  amount 
)
inlinestatic
52 {
53 Player* target = handler->getSelectedPlayer();
54 if (!target)
55 {
57 return false;
58 }
59
60 // check online security
61 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
62 return false;
63
64 target->RewardHonor(nullptr, 1, amount);
65 return true;
66 }
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:545
void SendErrorMessage(uint32 entry)
Definition Chat.cpp:216
Player * getSelectedPlayer() const
Definition Chat.cpp:374
bool HasLowerSecurity(Player *target, ObjectGuid guid=ObjectGuid::Empty, bool strong=false)
Definition Chat.cpp:57
static ObjectGuid const Empty
Definition ObjectGuid.h:120
Definition Player.h:1084
bool RewardHonor(Unit *victim, uint32 groupsize, int32 honor=-1, bool awardXP=true)
Definition Player.cpp:6082

References ObjectGuid::Empty, ChatHandler::getSelectedPlayer(), ChatHandler::HasLowerSecurity(), LANG_PLAYER_NOT_FOUND, Player::RewardHonor(), and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleHonorAddKillCommand()

static bool honor_commandscript::HandleHonorAddKillCommand ( ChatHandler handler)
inlinestatic
69 {
70 Unit* target = handler->getSelectedUnit();
71 if (!target)
72 {
74 return false;
75 }
76
77 // check online security
78 if (Player* player = target->ToPlayer())
79 if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
80 return false;
81
82 handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
83 return true;
84 }
WorldSession * GetSession()
Definition Chat.h:242
Unit * getSelectedUnit() const
Definition Chat.cpp:386
Player * ToPlayer()
Definition Object.h:202
Definition Unit.h:664
Player * GetPlayer() const
Definition WorldSession.h:444

References ObjectGuid::Empty, WorldSession::GetPlayer(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), ChatHandler::HasLowerSecurity(), LANG_PLAYER_NOT_FOUND, Player::RewardHonor(), ChatHandler::SendErrorMessage(), and Object::ToPlayer().

Referenced by GetCommands().

◆ HandleHonorUpdateCommand()

static bool honor_commandscript::HandleHonorUpdateCommand ( ChatHandler handler)
inlinestatic
87 {
88 Player* target = handler->getSelectedPlayer();
89 if (!target)
90 {
92 return false;
93 }
94
95 // check online security
96 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
97 return false;
98
99 target->UpdateHonorFields();
100 return true;
101 }
void UpdateHonorFields()
Definition PlayerUpdates.cpp:1177

References ObjectGuid::Empty, ChatHandler::getSelectedPlayer(), ChatHandler::HasLowerSecurity(), LANG_PLAYER_NOT_FOUND, ChatHandler::SendErrorMessage(), and Player::UpdateHonorFields().

Referenced by GetCommands().


The documentation for this class was generated from the following file: