TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
honor_commandscript Class Reference

Public Member Functions

 honor_commandscript ()
 
std::vector< ChatCommandGetCommands () const override
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Static Public Member Functions

static bool HandleHonorAddCommand (ChatHandler *handler, char const *args)
 
static bool HandleHonorAddKillCommand (ChatHandler *handler, char const *)
 
static bool HandleHonorUpdateCommand (ChatHandler *handler, char const *)
 

Additional Inherited Members

- Protected Member Functions inherited from CommandScript
 CommandScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 

Constructor & Destructor Documentation

honor_commandscript::honor_commandscript ( )
inline
34 : CommandScript("honor_commandscript") { }
CommandScript(const char *name)
Definition: ScriptMgr.cpp:1616

Member Function Documentation

std::vector<ChatCommand> honor_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

37  {
38  static std::vector<ChatCommand> honorAddCommandTable =
39  {
42  };
43 
44  static std::vector<ChatCommand> honorCommandTable =
45  {
46  { "add", rbac::RBAC_PERM_COMMAND_HONOR_ADD, false, NULL, "", honorAddCommandTable },
48  };
49 
50  static std::vector<ChatCommand> commandTable =
51  {
52  { "honor", rbac::RBAC_PERM_COMMAND_HONOR, false, NULL, "", honorCommandTable },
53  };
54  return commandTable;
55  }
static bool HandleHonorUpdateCommand(ChatHandler *handler, char const *)
Definition: cs_honor.cpp:98
arena_t NULL
Definition: jemalloc_internal.h:624
static bool HandleHonorAddCommand(ChatHandler *handler, char const *args)
Definition: cs_honor.cpp:57
Definition: RBAC.h:315
Definition: RBAC.h:316
static bool HandleHonorAddKillCommand(ChatHandler *handler, char const *)
Definition: cs_honor.cpp:79

+ Here is the call graph for this function:

static bool honor_commandscript::HandleHonorAddCommand ( ChatHandler handler,
char const args 
)
inlinestatic
58  {
59  if (!*args)
60  return false;
61 
62  Player* target = handler->getSelectedPlayer();
63  if (!target)
64  {
66  handler->SetSentErrorMessage(true);
67  return false;
68  }
69 
70  // check online security
71  if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
72  return false;
73 
74  uint32 amount = (uint32)atoi(args);
75  target->RewardHonor(NULL, 1, amount);
76  return true;
77  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
arena_t NULL
Definition: jemalloc_internal.h:624
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
uint32_t uint32
Definition: Define.h:150
Player * getSelectedPlayer()
Definition: Chat.cpp:579
uint32_t uint32
Definition: g3dmath.h:168
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:509

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool honor_commandscript::HandleHonorAddKillCommand ( ChatHandler handler,
char const  
)
inlinestatic
80  {
81  Unit* target = handler->getSelectedUnit();
82  if (!target)
83  {
85  handler->SetSentErrorMessage(true);
86  return false;
87  }
88 
89  // check online security
90  if (Player* player = target->ToPlayer())
91  if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
92  return false;
93 
94  handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
95  return true;
96  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Unit * getSelectedUnit()
Definition: Chat.cpp:591
Player * GetPlayer() const
Definition: WorldSession.h:927
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
Player * ToPlayer()
Definition: Object.h:191
WorldSession * GetSession()
Definition: Chat.h:59
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:509
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool honor_commandscript::HandleHonorUpdateCommand ( ChatHandler handler,
char const  
)
inlinestatic
99  {
100  Player* target = handler->getSelectedPlayer();
101  if (!target)
102  {
104  handler->SetSentErrorMessage(true);
105  return false;
106  }
107 
108  // check online security
109  if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
110  return false;
111 
112  target->UpdateHonorFields();
113  return true;
114  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
Player * getSelectedPlayer()
Definition: Chat.cpp:579
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:509

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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