C# Class ACR_ServerCommunicator.ACR_ServerCommunicator

Inheritance: CLRScriptFramework.CLRScriptBase, ICLRScriptImplementation
Show file Open project: ALandFarAway/ALFA-Base-Resources Class Usage Examples

Public Properties

Property Type Description
ScriptParameterTypes System.Type[]

Public Methods

Method Description
ACR_ServerCommunicator ( [ Intrinsics, [ Host ) : System
DispatchPeriodicEvents ( ) : void

Called to periodically dispatch events on the main thread.

GetDatabase ( ) : Database

Get the associated database object, creating it on demand if required.

GetLastTellFromPlayerId ( uint PlayerObject ) : int

Get the last receive tell from player id for a player.

GetLastTellToPlayerId ( uint PlayerObject ) : int

Get the last send tell to player id for a player.

GetLocalPlayerByAccountName ( string AccountName ) : uint

Get a local player by account name.

GetLocalPlayerByFirstName ( string FirstName ) : uint

Get a local player by (ambiguous) first name lookup.

GetLocalPlayerByName ( string First, string Last ) : uint

Get a local player by character name.

GetPlayerState ( uint PlayerObjectId ) : PlayerState

Look up the player state for a player in the internal lookup table.

GetServerName ( int ServerId ) : string

Get the name of a server.

IsCrossServerNotificationEnabled ( uint PlayerObject ) : bool

Get whether a player wishes to receive cross server event notifications.

RunScriptOnServer ( int DestinationServerID, string ScriptName, string ScriptArgument ) : void

Run a script on a remote server. The script must exist on the server. If acknowledgement is desired, it must be implemented in the form of a reply IPC request initiated by the script invoked. A script executed by this function must follow this prototype: void main(int SourceServerID, string Argument);

ScriptMain ( [ ScriptParameters, [ DefaultReturnCode ) : Int32
SendInfrastructureDiagnosticIrcMessage ( string Message ) : void

Send an infrastructure diagnostic notification message to the default IRC gateway and default error notify IRC recipient.

SendInfrastructureIrcMessage ( string Message ) : void

Send an infrastructure notification message to the default IRC gateway and recipient.

SetCrossServerNotificationsEnabled ( uint PlayerObject, bool Enabled ) : void

Sets whether a player wishes to receive cross server event notifications.

SetLastTellFromPlayerId ( uint PlayerObject, int PlayerId ) : void

Set the last receive tell from player id for a player.

SetLastTellToPlayerId ( uint PlayerObject, int PlayerId ) : void

Set the last send tell to player id for a player.

TryGetPlayerState ( uint PlayerObjectId ) : PlayerState

Look up the player state for a player in the internal lookup table.

Private Methods

Method Description
ACR_PopulateChatSelect ( uint PlayerObject ) : void

Populate the chat select GUI. This may be called as part of the enter event or the opening of the chat select GUI

ACR_ServerCommunicator ( [ Other ) : System
ActivateServerToServerPortal ( int ServerId, int PortalId, uint PlayerObjectId ) : void

Activate a server-to-server portal transfer to a remote server.

CommandDispatchLoop ( ) : void

This method periodically runs as a DelayCommand continuation. Its purpose is to check for commands from the worker thread and dispatch them as appropriate.

ConfigureWer ( ) : void

Configure Windows Error Reporting as appropriate.

ConfirmModuleOnline ( ) : bool

Check if this module is permitted to come online. Modules can be restricted to only being hosted by a particular machine in recovery scenarios to prevent an automatically started server instance on another machine from coming online inadvertently.

CreatePlayerState ( uint PlayerObjectId ) : void

Create a new player state object for a PC. It is assumed that there is no pre-existing state object for the PC yet.

DeletePlayerState ( uint PlayerObjectId ) : void

Remove the player state object for an outgoing PC.

DisableCharacterSave ( uint PlayerObjectId ) : bool

This method asks the vault plugin to blackhole the next character save for a given file name. The blackhole is removed at login time by the client enter handler.

DrainCommandQueue ( ) : void

This method drains items from the IPC thread command queue, i.e. those actions that must be performed in a script context because they need to call script APIs.

EnableCharacterSave ( uint PlayerObjectId ) : bool

This method asks the vault plugin to remove any blackhole to stop character saves for a given file name.

EnqueueExecuteQuery ( string Query ) : void

Enqueue an execute-only (no return value) query to the query thread.

GameDifficultyCheck ( ) : void

This method periodically runs as a DelayCommand continuation. Its purpose is to check for an appropriate game difficulty level.

GetNetworkManager ( ) : ACR_ServerCommunicator.ServerNetworkManager

Get the overarching network management subsystem.

GetPlayerByAccountName ( string AccountName ) : ACR_ServerCommunicator.GamePlayer

Get a global player by account name.

GetPlayerByFirstName ( string FirstName ) : ACR_ServerCommunicator.GamePlayer

Get a global player by (ambiguous) first name lookup. Note that only locally resolveable players can be searched with the ambiguous lookup mode.

GetPlayerByName ( string First, string Last ) : ACR_ServerCommunicator.GamePlayer

Get a global player by character name.

GetPlayerLatency ( uint PlayerObject ) : int

Get the last reported latency measurement for a player.

HandleChatEvent ( int ChatMode, string ChatText, uint SenderObjectId ) : int

This method filters module chat events. Its purpose is to check for commands internal to the server-to-server communication system and dispatch these as appropriate.

HandleClientEnter ( uint PlayerObject ) : void

This method handles ClientEnter events and sends the banner to the entering PC.

HandleClientLeave ( uint PlayerObject ) : void

This method handles ClientLeave events and cleans up local player state for the outgoing PC.

HandleLatencyCheckResponse ( uint PlayerObject ) : void

Handle the client's check-in response to a latency test.

HandleQuarantinePlayer ( uint PlayerObjectId ) : bool

This method is called when a player is being quarantined. Its purpose is to check configuration to identify whether the player should have saves disabled, and, if so, disable saves for the in quarantine player.

InitializeServerCommunicator ( ) : void

This method initializes the server communicator (one-time startup processing).

IsCharacterSpooled ( uint PlayerObjectId ) : bool

This method checks if the player object has a character file that is still in the spool, waiting for remote upload.

IsServerOnline ( int ServerId ) : bool

Check whether a server is online.

IsServerPublic ( int ServerId ) : bool

Check whether a server is marked as public.

ListOnlineServers ( uint PlayerObject ) : void

Send a textural description of the online server list to a player on the local server.

ListOnlineUsers ( uint PlayerObject ) : void

Send a textural description of the online player list to player on the local server.

ParseSendIrcMessage ( string Text, uint SenderObjectId ) : void

Parse out a #ircmsg [recipient] [msg] command and act on it.

PatchContentFiles ( ) : void

Apply content patches as appropriate.

PollModuleOnlineAllowed ( ) : void

Set up a polling cycle to check for whether the module is allowed to come online.

PortalStatusCheck ( uint PlayerObjectId, GameServer Server ) : void

This method periodically notifies the player of the current portal status until the portal attempt completes (or is aborted).

ProcessTellCommand ( string Start, uint SenderObjectId, TELL_TYPE TellType ) : void

Parse and act on a tell style internal command.

RecordModuleResources ( ) : void

Discover and record resources located in the module proper, and log them to the database.

ResolveCharacterNameToPlayerId ( string CharacterName ) : int

Look up a character by name and return the owning player id. The local cache (only) is queried. If the character was not in the local cache (which implies that the player was not online), then no query to the database is made and 0 is returned.

ResolvePlayerIdToServerId ( int PlayerId ) : int

Look up a player by player id and return the server id of their primary logged on character. If the player isn't logged on or the player id was invalid, zero is returned.

ResolvePlayerName ( string PlayerName ) : int

Look up a player by name and return the character id. The local cache (only) is queried. If the player was not in the local cache (which implies that the player was not online), then no query to the database is made and 0 is returned.

RunPatchInitScript ( ) : void

Call a predefined patch initialization script at startup time. The script is never included in a hak or module, but only distributed by the content patch system. It may or may not actually be present but if it is present, it would typically reside in override. The purpose of the function is to give a hotfix script a chance to hook callbacks in the game world if necessary.

RunUpdateServerExternalAddress ( ) : void

This method checks if an external hostname update is ready. If so, then the database is updated.

SendFeedbackError ( uint PlayerObjectId, string Message ) : void

Send a feedback error message to a player.

SendIrcMessage ( int GatewayId, string Recipient, uint SenderObjectId, string Message ) : void

Send an IRC message via an IRC gateway.

SendServerToServerTell ( uint SenderObjectId, ACR_ServerCommunicator.GamePlayer SenderPlayer, ACR_ServerCommunicator.GamePlayer RecipientPlayer, string Message ) : void

This method initiates a server-to-server tell.

SendTellReply ( uint SenderObjectId, string Message, bool ReTell ) : void

This method sends a reply tell to the last tell sender.

ShowHelp ( uint PlayerObject ) : void

This method sends command help text to a player.

ShowInternalState ( uint PlayerObject ) : void

This method dumps the internal state of the game world manager out.

ShowLastLoginTime ( uint PlayerObject, string Name ) : void

This method looks up the last login time for a player.

ShowRecordData ( uint PlayerObject, string Name ) : void

This method looks up various data records for a player.

ShowServerLatency ( uint PlayerObject ) : void

This method sends a description of the server's latency characteristics to a player.

ShowServerUptime ( uint PlayerObject ) : void

This method sends the server uptime to a player.

SignalIPCEvent ( int SourcePlayerId, int SourceServerId, int DestinationPlayerId, int DestinationServerId, int EventType, string EventText ) : void

Signal an IPC event to a server's IPC event queue.

StartAccountAssociationCheck ( uint PlayerObject ) : void

Start a check to determine whether the player has associated a forum account in the database. The check runs asynchronously to avoid blocking the main thread.

UpdatePlayerLatency ( uint PlayerObject ) : void

This method requests an update for player latency for a given player object.

UpdateServerExternalAddress ( ) : void

This method periodically runs as a DelayCommand continuation. Its purpose is to refresh the database's view of our network address, so that server-to-server portals still function if the external address changes without a server process restart.

Method Details

ACR_ServerCommunicator() public method

public ACR_ServerCommunicator ( [ Intrinsics, [ Host ) : System
Intrinsics [
Host [
return System

DispatchPeriodicEvents() public method

Called to periodically dispatch events on the main thread.
public DispatchPeriodicEvents ( ) : void
return void

GetDatabase() public method

Get the associated database object, creating it on demand if required.
public GetDatabase ( ) : Database
return ALFA.Database

GetLastTellFromPlayerId() public method

Get the last receive tell from player id for a player.
public GetLastTellFromPlayerId ( uint PlayerObject ) : int
PlayerObject uint
return int

GetLastTellToPlayerId() public method

Get the last send tell to player id for a player.
public GetLastTellToPlayerId ( uint PlayerObject ) : int
PlayerObject uint Supplies the player whose last send tell /// to player id is to be retrieved.
return int

GetLocalPlayerByAccountName() public method

Get a local player by account name.
public GetLocalPlayerByAccountName ( string AccountName ) : uint
AccountName string Supplies the account name to look for. ///
return uint

GetLocalPlayerByFirstName() public method

Get a local player by (ambiguous) first name lookup.
public GetLocalPlayerByFirstName ( string FirstName ) : uint
FirstName string Supplies the first name to search for. ///
return uint

GetLocalPlayerByName() public method

Get a local player by character name.
public GetLocalPlayerByName ( string First, string Last ) : uint
First string Supplies the character first name.
Last string Optionally supplies the character last name. ///
return uint

GetPlayerState() public method

Look up the player state for a player in the internal lookup table.
public GetPlayerState ( uint PlayerObjectId ) : PlayerState
PlayerObjectId uint Supplies the PC object id to look up. ///
return PlayerState

GetServerName() public method

Get the name of a server.
public GetServerName ( int ServerId ) : string
ServerId int Supplies the id of the server to /// query.
return string

IsCrossServerNotificationEnabled() public method

Get whether a player wishes to receive cross server event notifications.
public IsCrossServerNotificationEnabled ( uint PlayerObject ) : bool
PlayerObject uint Supplies the PC object to query.
return bool

RunScriptOnServer() public method

Run a script on a remote server. The script must exist on the server. If acknowledgement is desired, it must be implemented in the form of a reply IPC request initiated by the script invoked. A script executed by this function must follow this prototype: void main(int SourceServerID, string Argument);
public RunScriptOnServer ( int DestinationServerID, string ScriptName, string ScriptArgument ) : void
DestinationServerID int Supplies the destination server /// ID.
ScriptName string Supplies the name of the script.
ScriptArgument string Supplies an optional argument to pass /// to the script.
return void

ScriptMain() public method

public ScriptMain ( [ ScriptParameters, [ DefaultReturnCode ) : Int32
ScriptParameters [
DefaultReturnCode [
return System.Int32

SendInfrastructureDiagnosticIrcMessage() public method

Send an infrastructure diagnostic notification message to the default IRC gateway and default error notify IRC recipient.
public SendInfrastructureDiagnosticIrcMessage ( string Message ) : void
Message string Supplies the message to send.
return void

SendInfrastructureIrcMessage() public method

Send an infrastructure notification message to the default IRC gateway and recipient.
public SendInfrastructureIrcMessage ( string Message ) : void
Message string Supplies the message to send.
return void

SetCrossServerNotificationsEnabled() public method

Sets whether a player wishes to receive cross server event notifications.
public SetCrossServerNotificationsEnabled ( uint PlayerObject, bool Enabled ) : void
PlayerObject uint Supplies the PC object to adjust the /// notification state of.
Enabled bool Supplies true if the PC wishes to receive /// cross server notifications, else false if the PC doesn't want to /// receive them.
return void

SetLastTellFromPlayerId() public method

Set the last receive tell from player id for a player.
public SetLastTellFromPlayerId ( uint PlayerObject, int PlayerId ) : void
PlayerObject uint Supplies the player to set the value /// for.
PlayerId int Supplies the player id that last sent a tell /// to the player.
return void

SetLastTellToPlayerId() public method

Set the last send tell to player id for a player.
public SetLastTellToPlayerId ( uint PlayerObject, int PlayerId ) : void
PlayerObject uint Supplies the player that sent the /// tell.
PlayerId int Supplies the player id that the player last /// sent a tell to.
return void

TryGetPlayerState() public method

Look up the player state for a player in the internal lookup table.
public TryGetPlayerState ( uint PlayerObjectId ) : PlayerState
PlayerObjectId uint Supplies the PC object id to look up. ///
return PlayerState

Property Details

ScriptParameterTypes public static property

public static Type[],System ScriptParameterTypes
return System.Type[]