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
30: CommandScript("honor_commandscript") { }
Definition CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable honor_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

33 {
34 static ChatCommandTable honorAddCommandTable =
35 {
38 };
39
40 static ChatCommandTable honorCommandTable =
41 {
42 { "add", honorAddCommandTable },
44 };
45
46 static ChatCommandTable commandTable =
47 {
48 { "honor", honorCommandTable }
49 };
50 return commandTable;
51 }
static bool HandleHonorAddCommand(ChatHandler *handler, uint32 amount)
Definition cs_honor.cpp:53
static bool HandleHonorUpdateCommand(ChatHandler *handler)
Definition cs_honor.cpp:88
static bool HandleHonorAddKillCommand(ChatHandler *handler)
Definition cs_honor.cpp:70
std::vector< ChatCommandBuilder > ChatCommandTable
Definition ChatCommand.h:46
@ RBAC_PERM_COMMAND_HONOR_UPDATE
Definition RBAC.h:246
@ RBAC_PERM_COMMAND_HONOR_ADD
Definition RBAC.h:244
@ RBAC_PERM_COMMAND_HONOR_ADD_KILL
Definition RBAC.h:245

References HandleHonorAddCommand(), HandleHonorAddKillCommand(), HandleHonorUpdateCommand(), rbac::RBAC_PERM_COMMAND_HONOR_ADD, rbac::RBAC_PERM_COMMAND_HONOR_ADD_KILL, and rbac::RBAC_PERM_COMMAND_HONOR_UPDATE.

◆ HandleHonorAddCommand()

static bool honor_commandscript::HandleHonorAddCommand ( ChatHandler handler,
uint32  amount 
)
inlinestatic
54 {
55 Player* target = handler->getSelectedPlayer();
56 if (!target)
57 {
59 return false;
60 }
61
62 // check online security
63 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
64 return false;
65
66 target->RewardHonor(nullptr, 1, amount);
67 return true;
68 }
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:548
void SendErrorMessage(uint32 entry)
Definition Chat.cpp:224
Player * getSelectedPlayer() const
Definition Chat.cpp:382
bool HasLowerSecurity(Player *target, ObjectGuid guid=ObjectGuid::Empty, bool strong=false)
Definition Chat.cpp:65
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:6097

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
71 {
72 Unit* target = handler->getSelectedUnit();
73 if (!target)
74 {
76 return false;
77 }
78
79 // check online security
80 if (Player* player = target->ToPlayer())
81 if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
82 return false;
83
84 handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
85 return true;
86 }
WorldSession * GetSession()
Definition Chat.h:242
Unit * getSelectedUnit() const
Definition Chat.cpp:394
Player * ToPlayer()
Definition Object.h:202
Definition Unit.h:664
Player * GetPlayer() const
Definition WorldSession.h:454

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
89 {
90 Player* target = handler->getSelectedPlayer();
91 if (!target)
92 {
94 return false;
95 }
96
97 // check online security
98 if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
99 return false;
100
101 target->UpdateHonorFields();
102 return true;
103 }
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: