C# 클래스 ALFA.Database

This class encapsulates database access for ALFA CLR scripts. Unlike the ad-hoc ALFA.MySQLDatabase class, this class supports a single, "canonical" standard default database connection with the following properties: - There is only one underlying connection so queries are completed in order. - The combined query queue ("ACR_AsyncSQLQuery[Ex]") is synchronized with queries issued on an ALFA.Database object. - All instances of ALFA.Database are synchronized with one another. Generally, "state changing" queries that have to synchronize with the updates performed via NWScript must go through this query. Queries that may be processed independently, e.g. the GameWorldManager in the ACR_ServerCommunicator, may use a standalone connection instead for better performance if they do not require synchronization with the canonical database connection.
상속: IALFADatabase
파일 보기 프로젝트 열기: ALandFarAway/ALFA-Base-Resources 1 사용 예제들

공개 메소드들

메소드 설명
ACR_AsyncSQLQuery ( string Query ) : void

Perform an asynchronous database query. The query is added to the module object's query queue.

ACR_AsyncSQLQueryEx ( string Query, UInt32 QueueTo, ACR_QUERY_FLAGS Flags = ACR_QUERY_FLAGS.None ) : void

Perform an asynchronous database query. The query is added to a specific object's query queue (must be a PC or the module).

ACR_ConvertDatabaseStringToBoolean ( string Str ) : bool

Convert a database string to a Boolean value.

ACR_DeletePersistentVariable ( UInt32 Object, string VarName ) : void

Delete a persistent record.

ACR_FlushAllQueryQueues ( ) : void

Flush all query queues in the system out to the database.

ACR_FlushQueryQueue ( uint ObjectToFlush ) : void

This routine flushes the query queue for an object. It is useful, for example, in server portal scenarios. Normally, the query queue is flushed automatically.

ACR_GetBuildDate ( ) : string

Get the build date of the module OnLoad script (i.e. the time at which the module had its scripts nominally compiled).

ACR_GetCharacterID ( UInt32 PCObject ) : int

This routine returns the database character ID for a player given their PC object id.

ACR_GetHAKBuildDate ( ) : string

Get the build date of the HAK version check script (i.e. the time at which the ACR HAK had its scripts nominally compiled).

ACR_GetHAKVersion ( ) : string

Get the version string of the ACR release that the HAK corresponds to. For example, "1.84".

ACR_GetIsMember ( UInt32 PCObject ) : bool

Returns whether a PC is a fully approved ALFA member (vs. a new account that might be a throw-away, etc.).

ACR_GetIsPCQuarantined ( UInt32 PCObject ) : bool

Return whether a PC is quarantined.

ACR_GetPCLocalFlags ( UInt32 PCObject ) : int

Return the current PC local flags value for a PC.

ACR_GetPersistentFloat ( UInt32 Object, string VarName ) : float

Retrieve a float from the persistent store.

ACR_GetPersistentInt ( UInt32 Object, string VarName ) : int

Retrieve an int from the persistent store.

ACR_GetPersistentLocation ( UInt32 Object, string VarName ) : NWScript.NWScriptEngineStructure2

Retrieve a location from the persistent store.

ACR_GetPersistentString ( UInt32 Object, string VarName ) : string

Retrieve a string from the persistent store.

ACR_GetPersistentVector ( UInt32 Object, string VarName ) : System.Vector3

Retrieve a vector from the persistent store.

ACR_GetPlayerID ( UInt32 PCObject ) : int

This routine returns the database player ID for a player given their PC object id.

ACR_GetServerAddressFromDatabase ( ) : string

This routine queries the database in order to return the public IP address of the game server host.

ACR_GetServerID ( ) : int

This routine returns the database server ID of the current server.

ACR_GetVersion ( ) : string

Get the version string of the ACR release that the module was compiled against. For example, "1.84".

ACR_IncrementStatistic ( string Statistic ) : void

Increment a global tracking statistic counter stored in the database (if statistic tracking was enabled).

ACR_IsServerAdmin ( UInt32 PCObject ) : bool

This routine determines whether a player is a server admin for the current server.

ACR_LocationToString ( NWScript.NWScriptEngineStructure2 Location ) : string

This routine packages a location object into a string.

ACR_LogEvent ( uint Character, string EventName, string EventDescription, uint DM ) : void

Log an event to the database log.

ACR_PCSave ( uint PCToSave, bool Export, bool SaveLocation ) : void

This routine performs a character save.

ACR_PCUpdateStatus ( uint PCToUpdate, bool UpdateLocation ) : void

This method updates regularly-saved persistent information.

ACR_PPSValidatePC ( uint PCToValidate ) : void

This routine validates a character from quarantine.

ACR_RestOnClientEnter ( uint PCToRest ) : void

This method calculates offline resting for a PC after logging in.

ACR_RunScriptOnServer ( int DestinationServerID, string ScriptName, string ScriptArgument ) : bool

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);

ACR_SQLEncodeSpecialChars ( string s ) : string

This routine escapes characters for a SQL query.

ACR_SQLExecute ( string SQL ) : void

This routine performs a synchronous SQL query. If there were pending asynchronous queries in the queue, the pending queries are drained first. The query must not return any results.

ACR_SQLFetch ( ) : bool

This routine fetches the next rowset from the database.

ACR_SQLGetAffectedRows ( ) : int

This routine returns the number of rows affected by a query.

ACR_SQLGetData ( ) : string

This routine returns the first column of data from the current SQL rowset.

ACR_SQLGetData ( int ColumnIndex ) : string

This routine returns the specified column of data from the current SQL rowset.

ACR_SQLQuery ( string SQL ) : void

This routine performs a synchronous SQL query. If there were pending asynchronous queries in the queue, the pending queries are drained first.

ACR_SetPCLocalFlags ( UInt32 PCObject, int Flags ) : void

Assigns the current PC local flags value for a PC.

ACR_SetPersistentFloat ( UInt32 Object, string VarName, float Value ) : void

Set a floating point value in the persistent store.

ACR_SetPersistentInt ( UInt32 Object, string VarName, int Value ) : void

Set an integer value in the persistent store.

ACR_SetPersistentLocation ( UInt32 Object, string VarName, NWScript.NWScriptEngineStructure2 Value ) : void

Set a vector value in the persistent store.

ACR_SetPersistentString ( UInt32 Object, string VarName, string Value ) : void

Set a string value in the persistent store.

ACR_SetPersistentVector ( UInt32 Object, string VarName, System.Vector3 Value ) : void

Set a vector value in the persistent store.

ACR_StringToLocation ( string sLocation ) : NWScript.NWScriptEngineStructure2

This routine converts a string to a location.

ACR_StringToLocationData ( string sLocation ) : LOCATION_DATA

This routine converts a string to its component location data fields.

ACR_StringToVector ( string sVector ) : System.Vector3

Convert a string to a vector.

ACR_VectorToString ( System.Vector3 v ) : string

This routine packages a vector into a string.

ACR_XPOnClientLoaded ( uint PCToXP ) : void

This method calculates RPXP for the last playing session.

Database ( CLRScriptBase ScriptBase ) : System

Create a new database object (which can be shared by multiple script objects).

비공개 메소드들

메소드 설명
DemandInitialize ( ) : void

This method performs demand initialization of the database system on the first database call.

RegisterScriptSituationDelegate ( IGeneratedScriptProgram DelegateScript ) : void

This method sets the user's script object to delegate unrecognized script situations to the NWScript library script, allowing a delay continuation started by called NWScript code to function properly.

메소드 상세

ACR_AsyncSQLQuery() 공개 메소드

Perform an asynchronous database query. The query is added to the module object's query queue.
public ACR_AsyncSQLQuery ( string Query ) : void
Query string Supplies the query string.
리턴 void

ACR_AsyncSQLQueryEx() 공개 메소드

Perform an asynchronous database query. The query is added to a specific object's query queue (must be a PC or the module).
public ACR_AsyncSQLQueryEx ( string Query, UInt32 QueueTo, ACR_QUERY_FLAGS Flags = ACR_QUERY_FLAGS.None ) : void
Query string Supplies the query string.
QueueTo System.UInt32 Supplies the object to queue the query to, /// which should be a PC or the module object.
Flags ACR_QUERY_FLAGS Supplies query flags.
리턴 void

ACR_ConvertDatabaseStringToBoolean() 공개 정적인 메소드

Convert a database string to a Boolean value.
public static ACR_ConvertDatabaseStringToBoolean ( string Str ) : bool
Str string Supplies the database string.
리턴 bool

ACR_DeletePersistentVariable() 공개 메소드

Delete a persistent record.
public ACR_DeletePersistentVariable ( UInt32 Object, string VarName ) : void
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to remove. ///
리턴 void

ACR_FlushAllQueryQueues() 공개 메소드

Flush all query queues in the system out to the database.
public ACR_FlushAllQueryQueues ( ) : void
리턴 void

ACR_FlushQueryQueue() 공개 메소드

This routine flushes the query queue for an object. It is useful, for example, in server portal scenarios. Normally, the query queue is flushed automatically.
public ACR_FlushQueryQueue ( uint ObjectToFlush ) : void
ObjectToFlush uint Supplies the object whose query queue /// should be flushed.
리턴 void

ACR_GetBuildDate() 공개 메소드

Get the build date of the module OnLoad script (i.e. the time at which the module had its scripts nominally compiled).
public ACR_GetBuildDate ( ) : string
리턴 string

ACR_GetCharacterID() 공개 메소드

This routine returns the database character ID for a player given their PC object id.
public ACR_GetCharacterID ( UInt32 PCObject ) : int
PCObject System.UInt32 Supplies the object ID of the player to /// query.
리턴 int

ACR_GetHAKBuildDate() 공개 메소드

Get the build date of the HAK version check script (i.e. the time at which the ACR HAK had its scripts nominally compiled).
public ACR_GetHAKBuildDate ( ) : string
리턴 string

ACR_GetHAKVersion() 공개 메소드

Get the version string of the ACR release that the HAK corresponds to. For example, "1.84".
public ACR_GetHAKVersion ( ) : string
리턴 string

ACR_GetIsMember() 공개 메소드

Returns whether a PC is a fully approved ALFA member (vs. a new account that might be a throw-away, etc.).
public ACR_GetIsMember ( UInt32 PCObject ) : bool
PCObject System.UInt32 Supplies the PC object.
리턴 bool

ACR_GetIsPCQuarantined() 공개 메소드

Return whether a PC is quarantined.
public ACR_GetIsPCQuarantined ( UInt32 PCObject ) : bool
PCObject System.UInt32 Supplies the PC object.
리턴 bool

ACR_GetPCLocalFlags() 공개 메소드

Return the current PC local flags value for a PC.
public ACR_GetPCLocalFlags ( UInt32 PCObject ) : int
PCObject System.UInt32 Supplies the PC object.
리턴 int

ACR_GetPersistentFloat() 공개 메소드

Retrieve a float from the persistent store.
public ACR_GetPersistentFloat ( UInt32 Object, string VarName ) : float
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to query.
리턴 float

ACR_GetPersistentInt() 공개 메소드

Retrieve an int from the persistent store.
public ACR_GetPersistentInt ( UInt32 Object, string VarName ) : int
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to query.
리턴 int

ACR_GetPersistentLocation() 공개 메소드

Retrieve a location from the persistent store.
public ACR_GetPersistentLocation ( UInt32 Object, string VarName ) : NWScript.NWScriptEngineStructure2
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to query.
리턴 NWScript.NWScriptEngineStructure2

ACR_GetPersistentString() 공개 메소드

Retrieve a string from the persistent store.
public ACR_GetPersistentString ( UInt32 Object, string VarName ) : string
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to query.
리턴 string

ACR_GetPersistentVector() 공개 메소드

Retrieve a vector from the persistent store.
public ACR_GetPersistentVector ( UInt32 Object, string VarName ) : System.Vector3
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to query.
리턴 System.Vector3

ACR_GetPlayerID() 공개 메소드

This routine returns the database player ID for a player given their PC object id.
public ACR_GetPlayerID ( UInt32 PCObject ) : int
PCObject System.UInt32 Supplies the object ID of the player to /// query.
리턴 int

ACR_GetServerAddressFromDatabase() 공개 메소드

This routine queries the database in order to return the public IP address of the game server host.
public ACR_GetServerAddressFromDatabase ( ) : string
리턴 string

ACR_GetServerID() 공개 메소드

This routine returns the database server ID of the current server.
public ACR_GetServerID ( ) : int
리턴 int

ACR_GetVersion() 공개 메소드

Get the version string of the ACR release that the module was compiled against. For example, "1.84".
public ACR_GetVersion ( ) : string
리턴 string

ACR_IncrementStatistic() 공개 메소드

Increment a global tracking statistic counter stored in the database (if statistic tracking was enabled).
public ACR_IncrementStatistic ( string Statistic ) : void
Statistic string Supplies the counter name.
리턴 void

ACR_IsServerAdmin() 공개 메소드

This routine determines whether a player is a server admin for the current server.
public ACR_IsServerAdmin ( UInt32 PCObject ) : bool
PCObject System.UInt32 Supplies the object ID of the player to /// query.
리턴 bool

ACR_LocationToString() 공개 메소드

This routine packages a location object into a string.
public ACR_LocationToString ( NWScript.NWScriptEngineStructure2 Location ) : string
Location NWScript.NWScriptEngineStructure2 Supplies the location to convert.
리턴 string

ACR_LogEvent() 공개 메소드

Log an event to the database log.
public ACR_LogEvent ( uint Character, string EventName, string EventDescription, uint DM ) : void
Character uint Supplies an optional character that is /// associated with the log event, else OBJECT_INVALID if none.
EventName string Supplies the log event name.
EventDescription string Supplies the log event description. ///
DM uint Supplies an optional DM character that is /// associated with the log event, else OBJECT_INVALID if none.
리턴 void

ACR_PCSave() 공개 메소드

This routine performs a character save.
public ACR_PCSave ( uint PCToSave, bool Export, bool SaveLocation ) : void
PCToSave uint Supplies the object id of the player to /// save.
Export bool If true, save the character file to disk too. ///
SaveLocation bool If true, update the location of the /// player in the database.
리턴 void

ACR_PCUpdateStatus() 공개 메소드

This method updates regularly-saved persistent information.
public ACR_PCUpdateStatus ( uint PCToUpdate, bool UpdateLocation ) : void
PCToUpdate uint the PC to be updated
UpdateLocation bool whether or not to also update location
리턴 void

ACR_PPSValidatePC() 공개 메소드

This routine validates a character from quarantine.
public ACR_PPSValidatePC ( uint PCToValidate ) : void
PCToValidate uint
리턴 void

ACR_RestOnClientEnter() 공개 메소드

This method calculates offline resting for a PC after logging in.
public ACR_RestOnClientEnter ( uint PCToRest ) : void
PCToRest uint the PC to be rested
리턴 void

ACR_RunScriptOnServer() 공개 메소드

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 ACR_RunScriptOnServer ( int DestinationServerID, string ScriptName, string ScriptArgument ) : bool
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.
리턴 bool

ACR_SQLEncodeSpecialChars() 공개 메소드

This routine escapes characters for a SQL query.
public ACR_SQLEncodeSpecialChars ( string s ) : string
s string Supplies the string to escape.
리턴 string

ACR_SQLExecute() 공개 메소드

This routine performs a synchronous SQL query. If there were pending asynchronous queries in the queue, the pending queries are drained first. The query must not return any results.
public ACR_SQLExecute ( string SQL ) : void
SQL string Supplies the SQL query text to execute.
리턴 void

ACR_SQLFetch() 공개 메소드

This routine fetches the next rowset from the database.
public ACR_SQLFetch ( ) : bool
리턴 bool

ACR_SQLGetAffectedRows() 공개 메소드

This routine returns the number of rows affected by a query.
public ACR_SQLGetAffectedRows ( ) : int
리턴 int

ACR_SQLGetData() 공개 메소드

This routine returns the first column of data from the current SQL rowset.
public ACR_SQLGetData ( ) : string
리턴 string

ACR_SQLGetData() 공개 메소드

This routine returns the specified column of data from the current SQL rowset.
public ACR_SQLGetData ( int ColumnIndex ) : string
ColumnIndex int Supplies the zero-based column index to /// retrieve.
리턴 string

ACR_SQLQuery() 공개 메소드

This routine performs a synchronous SQL query. If there were pending asynchronous queries in the queue, the pending queries are drained first.
public ACR_SQLQuery ( string SQL ) : void
SQL string Supplies the SQL query text to execute.
리턴 void

ACR_SetPCLocalFlags() 공개 메소드

Assigns the current PC local flags value for a PC.
public ACR_SetPCLocalFlags ( UInt32 PCObject, int Flags ) : void
PCObject System.UInt32 Supplies the PC object.
Flags int Supplies the new Local Flags value.
리턴 void

ACR_SetPersistentFloat() 공개 메소드

Set a floating point value in the persistent store.
public ACR_SetPersistentFloat ( UInt32 Object, string VarName, float Value ) : void
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to set.
Value float Supplies the variable data.
리턴 void

ACR_SetPersistentInt() 공개 메소드

Set an integer value in the persistent store.
public ACR_SetPersistentInt ( UInt32 Object, string VarName, int Value ) : void
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to set.
Value int Supplies the variable data.
리턴 void

ACR_SetPersistentLocation() 공개 메소드

Set a vector value in the persistent store.
public ACR_SetPersistentLocation ( UInt32 Object, string VarName, NWScript.NWScriptEngineStructure2 Value ) : void
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to set.
Value NWScript.NWScriptEngineStructure2 Supplies the variable data.
리턴 void

ACR_SetPersistentString() 공개 메소드

Set a string value in the persistent store.
public ACR_SetPersistentString ( UInt32 Object, string VarName, string Value ) : void
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to set.
Value string Supplies the variable data.
리턴 void

ACR_SetPersistentVector() 공개 메소드

Set a vector value in the persistent store.
public ACR_SetPersistentVector ( UInt32 Object, string VarName, System.Vector3 Value ) : void
Object System.UInt32 Supplies the object whose persistent store is /// to be accessed.
VarName string Supplies the variable keyword to set.
Value System.Vector3 Supplies the variable data.
리턴 void

ACR_StringToLocation() 공개 메소드

This routine converts a string to a location.
public ACR_StringToLocation ( string sLocation ) : NWScript.NWScriptEngineStructure2
sLocation string Supplies the string to convert.
리턴 NWScript.NWScriptEngineStructure2

ACR_StringToLocationData() 공개 메소드

This routine converts a string to its component location data fields.
public ACR_StringToLocationData ( string sLocation ) : LOCATION_DATA
sLocation string Supplies the string to convert.
리턴 LOCATION_DATA

ACR_StringToVector() 공개 메소드

Convert a string to a vector.
public ACR_StringToVector ( string sVector ) : System.Vector3
sVector string Supplies the string to convert.
리턴 System.Vector3

ACR_VectorToString() 공개 메소드

This routine packages a vector into a string.
public ACR_VectorToString ( System.Vector3 v ) : string
v System.Vector3 Supplies the vector to convert.
리턴 string

ACR_XPOnClientLoaded() 공개 메소드

This method calculates RPXP for the last playing session.
public ACR_XPOnClientLoaded ( uint PCToXP ) : void
PCToXP uint the PC to XP
리턴 void

Database() 공개 메소드

Create a new database object (which can be shared by multiple script objects).
public Database ( CLRScriptBase ScriptBase ) : System
ScriptBase CLRScriptFramework.CLRScriptBase Supplies the associated script base class /// object, used to access script APIs.
리턴 System