ACR_ServerCommunicator.ACR_ServerCommunicator.GetDatabase C# (CSharp) Method

GetDatabase() public method

Get the associated database object, creating it on demand if required.
public GetDatabase ( ) : Database
return ALFA.Database
        public ALFA.Database GetDatabase()
        {
            if (Database == null)
                Database = new ALFA.Database(this);

            return Database;
        }

Usage Example

        /// <summary>
        /// Construct a new PlayerState object.
        /// </summary>
        /// <param name="ObjectId">Supplies the NWScript object id of the PC
        /// object.</param>
        /// <param name="Communicator">Supplies the server communicator
        /// instance that the PlayerState object is bound to.</param>
        public PlayerState(uint ObjectId, ACR_ServerCommunicator Communicator)
        {
            ALFA.Database Database = Communicator.GetDatabase();

            this.Communicator                 = Communicator;
            this.PCObjectId                   = ObjectId;
            this.PCCharacterId                = Database.ACR_GetCharacterID(ObjectId);
            this.PCPlayerId                   = Database.ACR_GetPlayerID(ObjectId);
            this.StateFlags                   = (PlayerStateFlags)Database.ACR_GetPersistentInt(ObjectId, "ACR_COMMUNICATOR_STATE_FLAGS");
            this.LatencyTickCount             = 0;
            this.LatencyToServer              = 0;
            this.ChatSelectLocalPlayersShown  = 0;
            this.ChatSelectLocalDMsShown      = 0;
            this.ChatSelectRemotePlayersShown = 0;
            this.ChatSelectRemoteDMsShown     = 0;

            //
            // Upgrade any legacy database settings to their new format.
            //

            UpgradeLegacySettings();
        }
All Usage Examples Of ACR_ServerCommunicator.ACR_ServerCommunicator::GetDatabase
ACR_ServerCommunicator