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

Public Member Functions

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

Static Public Member Functions

static bool HandleAchievementAddCommand (ChatHandler *handler, char const *args)
 

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

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

Member Function Documentation

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

Implements CommandScript.

37  {
38  static std::vector<ChatCommand> achievementCommandTable =
39  {
41  };
42  static std::vector<ChatCommand> commandTable =
43  {
44  { "achievement", rbac::RBAC_PERM_COMMAND_ACHIEVEMENT, false, NULL, "", achievementCommandTable },
45  };
46  return commandTable;
47  }
static bool HandleAchievementAddCommand(ChatHandler *handler, char const *args)
Definition: cs_achievement.cpp:49
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the call graph for this function:

static bool achievement_commandscript::HandleAchievementAddCommand ( ChatHandler handler,
char const args 
)
inlinestatic
50  {
51  if (!*args)
52  return false;
53 
54  uint32 achievementId = atoi((char*)args);
55  if (!achievementId)
56  {
57  if (char* id = handler->extractKeyFromLink((char*)args, "Hachievement"))
58  achievementId = atoi(id);
59  if (!achievementId)
60  return false;
61  }
62 
63  Player* target = handler->getSelectedPlayer();
64  if (!target)
65  {
67  handler->SetSentErrorMessage(true);
68  return false;
69  }
70 
71  if (AchievementEntry const* achievementEntry = sAchievementMgr->GetAchievement(achievementId))
72  target->CompletedAchievement(achievementEntry);
73 
74  return true;
75  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:140
Definition: DB2Structure.h:27
uint32_t uint32
Definition: Define.h:150
Player * getSelectedPlayer()
Definition: Chat.cpp:579
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
Definition: Chat.cpp:641
#define sAchievementMgr
Definition: AchievementMgr.h:501

+ 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: