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

Public Member Functions

 spectator_commandscript ()
 
ChatCommandTable GetCommands () const override
 
virtual std::vector< Acore::ChatCommands::ChatCommandBuilderGetCommands () const =0
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 

Static Public Member Functions

static bool HandleSpectatorCommand (ChatHandler *handler)
 
static bool HandleSpectatorVersionCommand (ChatHandler *handler, uint16 version)
 
static bool HandleSpectatorResetCommand (ChatHandler *handler)
 
static bool HandleSpectatorLeaveCommand (ChatHandler *handler)
 
static bool HandleSpectatorSpectateCommand (ChatHandler *handler, std::string const &name)
 
static bool HandleSpectatorWatchCommand (ChatHandler *handler, std::string const &name)
 

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 ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ spectator_commandscript()

spectator_commandscript::spectator_commandscript ( )
inline
31: CommandScript("spectator_commandscript") { }
Definition: ScriptMgr.h:849

Member Function Documentation

◆ GetCommands()

ChatCommandTable spectator_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

34 {
35 static ChatCommandTable spectatorCommandTable =
36 {
37 { "version", HandleSpectatorVersionCommand, SEC_PLAYER, Console::No },
38 { "reset", HandleSpectatorResetCommand, SEC_PLAYER, Console::No },
39 { "spectate", HandleSpectatorSpectateCommand, SEC_PLAYER, Console::No },
40 { "watch", HandleSpectatorWatchCommand, SEC_PLAYER, Console::No },
41 { "leave", HandleSpectatorLeaveCommand, SEC_PLAYER, Console::No },
42 { "", HandleSpectatorCommand, SEC_PLAYER, Console::No }
43 };
44 static ChatCommandTable commandTable =
45 {
46 { "spect", spectatorCommandTable }
47 };
48 return commandTable;
49 }
@ SEC_PLAYER
Definition: Common.h:66
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:50
static bool HandleSpectatorLeaveCommand(ChatHandler *handler)
Definition: cs_spectator.cpp:76
static bool HandleSpectatorWatchCommand(ChatHandler *handler, std::string const &name)
Definition: cs_spectator.cpp:98
static bool HandleSpectatorResetCommand(ChatHandler *handler)
Definition: cs_spectator.cpp:67
static bool HandleSpectatorCommand(ChatHandler *handler)
Definition: cs_spectator.cpp:51
static bool HandleSpectatorVersionCommand(ChatHandler *handler, uint16 version)
Definition: cs_spectator.cpp:60
static bool HandleSpectatorSpectateCommand(ChatHandler *handler, std::string const &name)
Definition: cs_spectator.cpp:90

References HandleSpectatorCommand(), HandleSpectatorLeaveCommand(), HandleSpectatorResetCommand(), HandleSpectatorSpectateCommand(), HandleSpectatorVersionCommand(), HandleSpectatorWatchCommand(), and SEC_PLAYER.

◆ HandleSpectatorCommand()

static bool spectator_commandscript::HandleSpectatorCommand ( ChatHandler handler)
inlinestatic
52 {
53 handler->PSendSysMessage("Incorrect syntax.");
54 handler->PSendSysMessage("Command has subcommands:");
55 handler->PSendSysMessage(" spectate");
56 handler->PSendSysMessage(" leave");
57 return true;
58 }
void PSendSysMessage(char const *fmt, Args &&... args)
Definition: Chat.h:60

References ChatHandler::PSendSysMessage().

Referenced by GetCommands().

◆ HandleSpectatorLeaveCommand()

static bool spectator_commandscript::HandleSpectatorLeaveCommand ( ChatHandler handler)
inlinestatic
77 {
78 Player* player = handler->GetSession()->GetPlayer();
79 if (!player->IsSpectator() || !player->FindMap() || !player->FindMap()->IsBattleArena())
80 {
81 handler->SendSysMessage("You are not a spectator.");
82 return true;
83 }
84
85 //player->SetIsSpectator(false);
86 player->TeleportToEntryPoint();
87 return true;
88 }
WorldSession * GetSession()
Definition: Chat.h:122
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:103
Map * FindMap() const
Definition: Object.h:518
Definition: Player.h:1046
bool TeleportToEntryPoint()
Definition: Player.cpp:1578
bool IsSpectator() const
Definition: Player.h:2521
bool IsBattleArena() const
Definition: Map.h:454
Player * GetPlayer() const
Definition: WorldSession.h:360

References WorldObject::FindMap(), WorldSession::GetPlayer(), ChatHandler::GetSession(), Map::IsBattleArena(), Player::IsSpectator(), ChatHandler::SendSysMessage(), and Player::TeleportToEntryPoint().

Referenced by GetCommands().

◆ HandleSpectatorResetCommand()

static bool spectator_commandscript::HandleSpectatorResetCommand ( ChatHandler handler)
inlinestatic
68 {
69 Player* p = handler->GetSession()->GetPlayer();
70 if (!p->IsSpectator())
71 return true;
73 return true;
74 }
AC_GAME_API void HandleResetCommand(Player *player)
Definition: ArenaSpectator.cpp:227

References WorldSession::GetPlayer(), ChatHandler::GetSession(), ArenaSpectator::HandleResetCommand(), and Player::IsSpectator().

Referenced by GetCommands().

◆ HandleSpectatorSpectateCommand()

static bool spectator_commandscript::HandleSpectatorSpectateCommand ( ChatHandler handler,
std::string const &  name 
)
inlinestatic
91 {
93 return false;
94
95 return true;
96 }
AC_GAME_API bool HandleSpectatorSpectateCommand(ChatHandler *handler, std::string const &name)
Definition: ArenaSpectator.cpp:29

References ArenaSpectator::HandleSpectatorSpectateCommand().

Referenced by GetCommands().

◆ HandleSpectatorVersionCommand()

static bool spectator_commandscript::HandleSpectatorVersionCommand ( ChatHandler handler,
uint16  version 
)
inlinestatic
61 {
62 if (version < SPECTATOR_ADDON_VERSION)
64 return true;
65 }
#define SPECTATOR_ADDON_PREFIX
Definition: ArenaSpectator.h:35
#define SPECTATOR_ADDON_VERSION
Definition: ArenaSpectator.h:33
void SendCommand(T *o, Format &&fmt, Args &&... args)
Definition: ArenaSpectator.h:47

References WorldSession::GetPlayer(), ChatHandler::GetSession(), ArenaSpectator::SendCommand(), SPECTATOR_ADDON_PREFIX, and SPECTATOR_ADDON_VERSION.

Referenced by GetCommands().

◆ HandleSpectatorWatchCommand()

static bool spectator_commandscript::HandleSpectatorWatchCommand ( ChatHandler handler,
std::string const &  name 
)
inlinestatic
99 {
101 return false;
102
103 return true;
104 }
AC_GAME_API bool HandleSpectatorWatchCommand(ChatHandler *handler, std::string const &name)
Definition: ArenaSpectator.cpp:177

References ArenaSpectator::HandleSpectatorWatchCommand().

Referenced by GetCommands().