#pragma once #include #include #include #include #include #include #include "GameServerEvents.h" #include "NetCommon.h" // {B2D67EE7-8063-488F-B3B9-E7DA675CB752} inline const GUID IID_IGameServer = { 0xb2d67ee7, 0x8063, 0x488f, 0xb3, 0xb9, 0xe7, 0xda, 0x67, 0x5c, 0xb7, 0x52 }; /// /// Defines an API for communicating with the game server. /// struct IGameServer : IComponent, IEventSource { virtual ~IGameServer() = default; /// /// Sends a chat message to all players or to a specified player. /// /// The chat message. /// Text color. /// Flags for the message. /// The index to send the message to. If 0, it will be sent to all players. virtual void STDMETHODCALLTYPE SendChatMessage(const tstring_view& message, ChatColor color, int flags, PlayerIndex indexTo) = 0; /// /// Bans the player at the specified index. /// /// The player index. /// virtual void STDMETHODCALLTYPE BanPlayer(int index) = 0; /// /// Kicks the player at the specified index. /// /// The player index. /// The reason for kicking the player. /// virtual void STDMETHODCALLTYPE KickPlayer(int index, KickReason reason) = 0; /// /// Gets player data for the specified index. /// /// The zero-based player index. /// std::out_of_range virtual const std::shared_ptr STDMETHODCALLTYPE GetPlayer(int index) const = 0; /// /// Gets data for all players in the current game. /// virtual std::vector> STDMETHODCALLTYPE GetPlayers() const = 0; /// /// Toggles or increments the specified game option. /// Note: the behavior of this method is the same as changing an option from the F1 in-game menu. /// /// /// virtual void STDMETHODCALLTYPE ChangeGameOption(GameOption option) = 0; /// /// Gets details for the current game. /// virtual const std::shared_ptr STDMETHODCALLTYPE GetGameDetails() const = 0; /// /// Modifies the settings for the current game. /// /// The game details. virtual void STDMETHODCALLTYPE ChangeGameDetails(const NetGameDetails& gameDetails) = 0; }; struct DECLSPEC_UUID("{B2D67EE7-8063-488F-B3B9-E7DA675CB752}") IGameServer;