Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
MessagingManager Class Reference

Messaging manager. Allows to send server messages, notifications and chat messages. More...

#include <MessagingManager.h>

+ Inheritance diagram for MessagingManager:
+ Collaboration diagram for MessagingManager:

Public Member Functions

template<typename T , typename... Args>
FORCEINLINE void SendServerMessage (AShooterPlayerController *player_controller, FLinearColor msg_color, const T *msg, Args &&... args)
 Sends server message to the specific player. Using fmt::format.
 
template<typename T , typename... Args>
FORCEINLINE void SendNotification (AShooterPlayerController *player_controller, FLinearColor color, float display_scale, float display_time, UTexture2D *icon, const T *msg, Args &&... args)
 Sends notification (on-screen message) to the specific player. Using fmt::format.
 
template<typename T , typename... Args>
FORCEINLINE void SendChatMessage (AShooterPlayerController *player_controller, const FString &sender_name, const T *msg, Args &&... args)
 Sends chat message to the specific player. Using fmt::format.
 
template<typename T , typename... Args>
FORCEINLINE void SendServerMessageToAll (FLinearColor msg_color, const T *msg, Args &&... args)
 Sends server message to all players. Using fmt::format.
 
template<typename T , typename... Args>
FORCEINLINE void SendNotificationToAll (FLinearColor color, float display_scale, float display_time, UTexture2D *icon, const T *msg, Args &&... args)
 Sends notification (on-screen message) to all players. Using fmt::format.
 
template<typename T , typename... Args>
FORCEINLINE void SendChatMessageToAll (const FString &sender_name, const T *msg, Args &&... args)
 Sends chat message to all players. Using fmt::format.
 
virtual std::optional< std::string > MeetsRequirementsToWork ()
 Returns wether this messaging manager is able to work in the current session.
 
void SetWorldContext (UWorld *world_context)
 Sets the world context. This is called by the API automatically.
 

Protected Member Functions

virtual void SendChatMessage_Impl (AShooterPlayerController *player_controller, const FString &sender_name, const FString &msg)
 
virtual void SendNotification_Impl (AShooterPlayerController *player_controller, FLinearColor color, float display_scale, float display_time, UTexture2D *icon, const FString &msg)
 

Protected Attributes

 : virtual void SendServerMessage_Impl(AShooterPlayerController* player_controller
 
FLinearColor msg_color
 
FLinearColor const FStringmsg
 
player_controller ClientServerChatDirectMessage & msg
 
 : UWorld* WorldContext = nullptr
 

Detailed Description

Messaging manager. Allows to send server messages, notifications and chat messages.

Usage:

  1. Create a class that inherits from MessagingManager
  2. Redefine the functions needed. The default implementation is provided in the base class
  3. Register it with AsaApi::GetApiUtils().SetMessagingManager<YourMessagingManagerClass>();

Definition at line 12 of file MessagingManager.h.

Member Function Documentation

◆ MeetsRequirementsToWork()

virtual std::optional< std::string > MessagingManager::MeetsRequirementsToWork ( )
inlinevirtual

Returns wether this messaging manager is able to work in the current session.

The default one does not depend in any mod or external service so it always returns true.

Subclasses should redefine this function if they depend on any external service.

If it returns an error, it will be removed and the plugin will fall back to the default API messaging manager.

Returns
Empty optional if no error, or optional filled with error string.

Reimplemented in AsaApiUtilsMessagingManager.

Definition at line 156 of file MessagingManager.h.

◆ SendChatMessage()

template<typename T , typename... Args>
FORCEINLINE void MessagingManager::SendChatMessage ( AShooterPlayerController * player_controller,
const FString & sender_name,
const T * msg,
Args &&... args )
inline

Sends chat message to the specific player. Using fmt::format.

Template Parameters
TEither a a char or wchar_t
ArgsOptional arguments types
Parameters
player_controllerPlayer
sender_nameName of the sender
msgMessage
argsOptional arguments

Definition at line 67 of file MessagingManager.h.

◆ SendChatMessage_Impl()

virtual void MessagingManager::SendChatMessage_Impl ( AShooterPlayerController * player_controller,
const FString & sender_name,
const FString & msg )
inlineprotectedvirtual

Definition at line 181 of file MessagingManager.h.

◆ SendChatMessageToAll()

template<typename T , typename... Args>
FORCEINLINE void MessagingManager::SendChatMessageToAll ( const FString & sender_name,
const T * msg,
Args &&... args )
inline

Sends chat message to all players. Using fmt::format.

Template Parameters
TEither a a char or wchar_t
ArgsOptional arguments types
Parameters
sender_nameName of the sender
msgMessage
argsOptional arguments

Definition at line 130 of file MessagingManager.h.

◆ SendNotification()

template<typename T , typename... Args>
FORCEINLINE void MessagingManager::SendNotification ( AShooterPlayerController * player_controller,
FLinearColor color,
float display_scale,
float display_time,
UTexture2D * icon,
const T * msg,
Args &&... args )
inline

Sends notification (on-screen message) to the specific player. Using fmt::format.

Template Parameters
TEither a a char or wchar_t
ArgsOptional arguments types
Parameters
player_controllerPlayer
colorMessage color
display_scaleSize of text
display_timeDisplay time
iconMessage icon (optional)
msgMessage
argsOptional arguments

Definition at line 47 of file MessagingManager.h.

◆ SendNotification_Impl()

virtual void MessagingManager::SendNotification_Impl ( AShooterPlayerController * player_controller,
FLinearColor color,
float display_scale,
float display_time,
UTexture2D * icon,
const FString & msg )
inlineprotectedvirtual

Reimplemented in AsaApiUtilsMessagingManager.

Definition at line 190 of file MessagingManager.h.

◆ SendNotificationToAll()

template<typename T , typename... Args>
FORCEINLINE void MessagingManager::SendNotificationToAll ( FLinearColor color,
float display_scale,
float display_time,
UTexture2D * icon,
const T * msg,
Args &&... args )
inline

Sends notification (on-screen message) to all players. Using fmt::format.

Template Parameters
TEither a a char or wchar_t
ArgsOptional arguments types
Parameters
colorMessage color
display_scaleSize of text
display_timeDisplay time
iconMessage icon (optional)
msgMessage
argsOptional arguments

Definition at line 107 of file MessagingManager.h.

◆ SendServerMessage()

template<typename T , typename... Args>
FORCEINLINE void MessagingManager::SendServerMessage ( AShooterPlayerController * player_controller,
FLinearColor msg_color,
const T * msg,
Args &&... args )
inline

Sends server message to the specific player. Using fmt::format.

Template Parameters
TEither a a char or wchar_t
ArgsOptional arguments types
Parameters
player_controllerPlayer
msg_colorMessage color
msgMessage
argsOptional arguments

Definition at line 25 of file MessagingManager.h.

◆ SendServerMessageToAll()

template<typename T , typename... Args>
FORCEINLINE void MessagingManager::SendServerMessageToAll ( FLinearColor msg_color,
const T * msg,
Args &&... args )
inline

Sends server message to all players. Using fmt::format.

Template Parameters
TEither a a char or wchar_t
ArgsOptional arguments types
Parameters
msg_colorMessage color
msgMessage
argsOptional arguments

Definition at line 86 of file MessagingManager.h.

◆ SetWorldContext()

void MessagingManager::SetWorldContext ( UWorld * world_context)
inline

Sets the world context. This is called by the API automatically.

Parameters
world_contextWorld context

Definition at line 167 of file MessagingManager.h.

Member Data Documentation

◆ __pad0__

MessagingManager::__pad0__
protected

Definition at line 167 of file MessagingManager.h.

◆ __pad1__

MessagingManager::__pad1__
protected

Definition at line 190 of file MessagingManager.h.

◆ msg [1/2]

FLinearColor const FString& MessagingManager::msg
protected
Initial value:

Definition at line 175 of file MessagingManager.h.

◆ msg [2/2]

player_controller ClientServerChatDirectMessage& MessagingManager::msg
protected

Definition at line 178 of file MessagingManager.h.

◆ msg_color

FLinearColor MessagingManager::msg_color
protected

Definition at line 175 of file MessagingManager.h.


The documentation for this class was generated from the following file: