#pragma once #include #include #include #include "Core/Public/Core.h" #include "GameServerEvents.h" #include "NetCommon.h" /// /// Defines an API for communicating with the game server. /// DEFINE_SERVICE_MULTI("{B2D67EE7-8063-488F-B3B9-E7DA675CB752}", IGameServer, 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 SendChatMessage(const tstring_view& message, ChatColor color, ChatFlag flags, PlayerIndex indexTo) = 0; /// /// Bans the player at the specified index. /// /// The player index. virtual void BanPlayer(int index) = 0; /// /// Removes the IP address from the ban list. /// /// The IP address. virtual void UnbanPlayer(const IPAddress & ipAddress) = 0; /// /// Gets the IP addresses that are currently banned. /// virtual const std::vector GetBans() const = 0; /// /// Kicks the player at the specified index. /// /// The player index. /// The reason for kicking the player. virtual void 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 GetPlayer(int index) const = 0; /// /// Gets data for all players in the current game. /// virtual std::vector> 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 ChangeGameOption(GameOption option) = 0; /// /// Gets details for the current game. /// virtual const std::shared_ptr GetGameDetails() const = 0; /// /// Modifies the settings for the current game. /// /// The game details. virtual void ChangeGameDetails(const NetGameDetails& gameDetails) = 0; };