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

Public Member Functions

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

Static Public Member Functions

static bool HandleBattlefieldStart (ChatHandler *handler, const char *args)
 
static bool HandleBattlefieldEnd (ChatHandler *handler, const char *args)
 
static bool HandleBattlefieldEnable (ChatHandler *handler, const char *args)
 
static bool HandleBattlefieldSwitch (ChatHandler *handler, const char *args)
 
static bool HandleBattlefieldTimer (ChatHandler *handler, const char *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

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

Member Function Documentation

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

Implements CommandScript.

35  {
36  static std::vector<ChatCommand> battlefieldcommandTable =
37  {
43  };
44  static std::vector<ChatCommand> commandTable =
45  {
46  { "bf", rbac::RBAC_PERM_COMMAND_BF, false, NULL, "", battlefieldcommandTable },
47  };
48  return commandTable;
49  }
static bool HandleBattlefieldEnd(ChatHandler *handler, const char *args)
Definition: cs_bf.cpp:73
Definition: RBAC.h:164
Definition: RBAC.h:167
static bool HandleBattlefieldTimer(ChatHandler *handler, const char *args)
Definition: cs_bf.cpp:146
static bool HandleBattlefieldEnable(ChatHandler *handler, const char *args)
Definition: cs_bf.cpp:95
arena_t NULL
Definition: jemalloc_internal.h:624
static bool HandleBattlefieldStart(ChatHandler *handler, const char *args)
Definition: cs_bf.cpp:51
Definition: RBAC.h:169
Definition: RBAC.h:166
Definition: RBAC.h:168
static bool HandleBattlefieldSwitch(ChatHandler *handler, const char *args)
Definition: cs_bf.cpp:125
Definition: RBAC.h:165

+ Here is the call graph for this function:

static bool bf_commandscript::HandleBattlefieldEnable ( ChatHandler handler,
const char *  args 
)
inlinestatic
96  {
97  uint32 battleid = 0;
98  char* battleid_str = strtok((char*)args, " ");
99  if (!battleid_str)
100  return false;
101 
102  battleid = atoi(battleid_str);
103 
104  Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
105 
106  if (!bf)
107  return false;
108 
109  if (bf->IsEnabled())
110  {
111  bf->ToggleBattlefield(false);
112  if (battleid == 1)
113  handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
114  }
115  else
116  {
117  bf->ToggleBattlefield(true);
118  if (battleid == 1)
119  handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
120  }
121 
122  return true;
123  }
void SendGlobalGMSysMessage(const char *str)
Definition: Chat.cpp:207
void ToggleBattlefield(bool enable)
Enable or Disable battlefield.
Definition: Battlefield.h:246
uint32_t uint32
Definition: Define.h:150
Definition: Battlefield.h:196
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
bool IsEnabled() const
Return if battlefield is enable.
Definition: Battlefield.h:248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool bf_commandscript::HandleBattlefieldEnd ( ChatHandler handler,
const char *  args 
)
inlinestatic
74  {
75  uint32 battleid = 0;
76  char* battleid_str = strtok((char*)args, " ");
77  if (!battleid_str)
78  return false;
79 
80  battleid = atoi(battleid_str);
81 
82  Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
83 
84  if (!bf)
85  return false;
86 
87  bf->EndBattle(true);
88 
89  if (battleid == 1)
90  handler->SendGlobalGMSysMessage("Wintergrasp (Command stop used)");
91 
92  return true;
93  }
void SendGlobalGMSysMessage(const char *str)
Definition: Chat.cpp:207
void EndBattle(bool endByTimer)
Definition: Battlefield.cpp:329
uint32_t uint32
Definition: Define.h:150
Definition: Battlefield.h:196
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool bf_commandscript::HandleBattlefieldStart ( ChatHandler handler,
const char *  args 
)
inlinestatic
52  {
53  uint32 battleid = 0;
54  char* battleid_str = strtok((char*)args, " ");
55  if (!battleid_str)
56  return false;
57 
58  battleid = atoi(battleid_str);
59 
60  Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
61 
62  if (!bf)
63  return false;
64 
65  bf->StartBattle();
66 
67  if (battleid == 1)
68  handler->SendGlobalGMSysMessage("Wintergrasp (Command start used)");
69 
70  return true;
71  }
void SendGlobalGMSysMessage(const char *str)
Definition: Chat.cpp:207
uint32_t uint32
Definition: Define.h:150
Definition: Battlefield.h:196
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
void StartBattle()
Definition: Battlefield.cpp:309

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool bf_commandscript::HandleBattlefieldSwitch ( ChatHandler handler,
const char *  args 
)
inlinestatic
126  {
127  uint32 battleid = 0;
128  char* battleid_str = strtok((char*)args, " ");
129  if (!battleid_str)
130  return false;
131 
132  battleid = atoi(battleid_str);
133 
134  Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
135 
136  if (!bf)
137  return false;
138 
139  bf->EndBattle(false);
140  if (battleid == 1)
141  handler->SendGlobalGMSysMessage("Wintergrasp (Command switch used)");
142 
143  return true;
144  }
void SendGlobalGMSysMessage(const char *str)
Definition: Chat.cpp:207
void EndBattle(bool endByTimer)
Definition: Battlefield.cpp:329
uint32_t uint32
Definition: Define.h:150
Definition: Battlefield.h:196
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool bf_commandscript::HandleBattlefieldTimer ( ChatHandler handler,
const char *  args 
)
inlinestatic
147  {
148  uint32 battleid = 0;
149  uint32 time = 0;
150  char* battleid_str = strtok((char*)args, " ");
151  if (!battleid_str)
152  return false;
153  char* time_str = strtok(NULL, " ");
154  if (!time_str)
155  return false;
156 
157  battleid = atoi(battleid_str);
158 
159  time = atoi(time_str);
160 
161  Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
162 
163  if (!bf)
164  return false;
165 
166  bf->SetTimer(time * IN_MILLISECONDS);
168  if (battleid == 1)
169  handler->SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
170 
171  return true;
172  }
void SendGlobalGMSysMessage(const char *str)
Definition: Chat.cpp:207
arena_t NULL
Definition: jemalloc_internal.h:624
void SetTimer(uint32 timer)
Definition: Battlefield.h:348
uint32_t uint32
Definition: Define.h:150
Definition: Battlefield.h:196
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
Definition: Common.h:103
virtual void SendInitWorldStatesToAll()=0
Send all worldstate data to all player in zone.

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