Objeto Mesa

.html ›› .html ›› .html ››
Parent Previous Next

Objeto Mesa

Este objeto representa uma mesa aberta no Firecast.


Herança

O Objeto Mesa possui todas as características de um WrappedObject. Veja:


Características

Além das características herdadas, o Objeto Mesa também possui as seguintes características:

Propriedades e atributos

Propriedade

Tipo

Descrição

audioPlayer

AudioPlayer object


(Read-only) Contains the AudioPlayer object utilized for playing audio within the room.


Audio played through this object will also be broadcasted to all online players.

For local playback only, consider using Audio.defaultPlayer instead.


codigoInterno

Integer

Somente leitura, contém o código interno da mesa que é usado para identificá-la unicamente em todo o RRPG Firecast.


firecastURI

String

(Read-only) A string containing the shareable Firecast URI for this room.


You can use this URI with the GUI.asyncOpenFirecastURI() function.


nome

String

Somente leitura, contém o nome da mesa.


msgStatus

String

Somente leitura, contém a mensagem de status da mesa.


site

String

Somente leitura, contém o endereço do site da mesa.


logotipo

String

Somente leitura, contém a URL da imagem logotipo da mesa.


sistema

String

Somente leitura, contém o sistema de RPG da mesa.


msgBoasVindas

String

Somente leitura, contém o texto da mensagem de boas vindas da mesa.


isRestrito18Anos

Boolean

Somente leitura, contém true se a mesa estiver marcada como não recomendada para menores de 18 anos.


haVagas

Boolean

Somente leitura, contém true se a mesa estiver marcada como há vagas.


isModerada

Boolean

Somente leitura, contém true se a mesa estiver marcada como Moderada.


podeTablesDock

Boolean

Somente leitura, contém true se a mesa pode exibir Table's Dock do usuário. É true quando o criador da mesa é Gold Plus ou quando o usuário local é assinante Gold.


jogadores

Arranjo de Objeto Jogador

Somente leitura, contém um arranjo de Objeto Jogador representando todos os usuários que estão conectados na mesa no momento.


Um arranjo é uma tabela lua indexada de 1 a N, onde N é o comprimento da tabela (operador # no lua)


meuJogador
or

me

Objeto Jogador

Somente leitura, contém o Objeto Jogador do usuário que está usando o Firecast.


library
or

biblioteca

Objeto BibliotecaItem

Somente leitura, contém o objeto BibliotecaItem raiz da biblioteca da mesa.


A raiz da biblioteca é aquela pasta que tem no topo da mesma, de nome "Biblioteca".


chat

Objeto Chat

Somente leitura, contém o Objeto Chat da interface de bate papo principal da mesa.


activeChat

Objeto Chat

Somente leitura, contém o Objeto Chat da mesa que está atualmente ativo/focado na interface.




Métodos

Método

Descrição

mesa:isType(typeName)

Retorna true se passado "mesa" como parâmetro.


mesa:findBibliotecaItem(codigoInterno)

Dado um número código interno, localiza o objeto BibliotecaItem que possui "codigoInterno" igual ao valor passado no parâmetro "codigoInterno".


Retorna um objeto BibliotecaItem ou nil caso não encontre.


mesa:findJogador(loginOuCodigoInterno)

Dado um login de usuário ou seu código interno, localiza o objeto Jogador correspondente representando o jogador atualmente na mesa.


Retorna um objeto Jogador ou nil caso não encontre.


Observação: A função retorna nil se o usuário não estiver na mesa no momento, mesmo quando o parâmetro passado for um login ou um código interno válido.


mesa:requestSetModerada(moderada)

Requisita a ativação/desativação da mesa moderada.


Parâmetros:

    • moderada - Booleano, onde true significa "Ativar a mesa moderada" e false "Desativar a mesa moderada".


Observações:

    • A alteração do comportamento "mesa moderada" só ocorre após o servidor Firecast aprovar a mudança.


mesa:abrirNDBDeMesa(nome, callback[, opcoes])

FUNÇÃO DESCONTINUADA! Utilize a função mesa:asyncOpenRoomNDB ao invés desta.


Abre um NodeDatabase da mesa que está fisicamente armazenado no servidor do Firecast.


Parâmetros:

    • nome - Cadeia de caracteres que identifica qual NodeDatabase remoto da mesa deve ser aberto.
    • callback - Uma função que será invocada quando o NodeDatabase for carregado ou quando ocorrer um erro no carregamento.
      • Quando o carregamento for bem sucedido, a função callback será chamada contendo o Objeto Nodo raiz do NodeDatabase no primeiro parâmetro.
      • Quando ocorrer algum erro no carregamento, a função callback será chamada contendo nil no primeiro parâmetro.
    • (OPCIONAL) opcoes - Uma tabela lua contendo as seguintes opções extras de carregamento do nodedatabase:
      • (OPCIONAL) criar - Um booleano que define o que fazer quando o NodeDatabase não existir no servidor. true = criar o nodeDatabase quando não existir, false = falhar (invocar a função callback com valor nil) quando o nodeDatabase não existir. Padrão se não informado: false.
      • (OPCIONAL) callbackDeCarga - Uma função que será invocada quando os dados do NodeDatabase começarem a ser carregados pela internet. Se você abrir duas vezes o mesmo NodeDatabase de mesa, a segunda vez não ocorrerá uma carga de dados pela internet pois o NDB já está carregado.


Observações:

    • Esta função é assíncrona, isto é, o código LUA continua sua execução normal enquanto o NDB é carregado em segundo plano. É preciso informar o parâmetro "callback" para obter o NodeDatabase carregado.
    • Cada mesa possui seu próprio conjunto de NodeDatabases que existem independentemente das outras mesas.
    • Alterações feitas no NodeDatabase aberto por esta função são automaticamente sincronizadas com os outros usuários que também abriram o mesmo NodeDatabase.
    • Se o usuário sair da mesa, o NodeDatabase terá sua conexão cortada e não mais sincronizará as alterações.
    • Por padrão, os usuários com o modo +mestre podem ler e alterar o NodeDatabase de mesa enquanto os demais usuários podem apenas ler valores.
    • Para abrir um NodeDatabase de mesa, uma das seguintes afirmativas deve ser verdadeira:
      • O usuário atual é assinante Gold; ou
      • O criador da mesa é assinante Platinum.


mesa:asyncCreateGroupPVT(logins[, params])


Asynchronously creates a group private chat with the specified users within this room.


Arguments:

  • logins - An array of strings containing the usernames to be invited to the group private chat.

  • (Optional) params - A Lua table that may contain the following optional fields:
    • autoFocus - A Boolean; "true" means Firecast should try to focus the open interface, while "false" means to open without focusing it. Default: "false".

Return:


Remarks:

  • The argument "logins" must not be empty and must identify users that are in the room. You don't need to put the current user login in that array.
  • It is not possible to create a private group chat with just the current user in it; there must be at least one other user.


Example:

local room = Firecast.getRoomOf(sheet);             

local promise = room:asyncCreateGroupPVT({"AlyssonRPG", "AnotherUser"});

local chat = await(promise);

chat:write("Hello!");



mesa:asyncOpenRoomNDB(name[, options])

Asynchronously open a room NodeDatabase which is physically stored on the Firecast server


Arguments:

  • name - A string identifying the remote NodeDatabase in this room to be opened
  • (Optional) options - A Lua table describing additional settings that may contain:
    • create - a boolean. If true, the NodeDatabase can be created if it does not exist. Default: false.
    • skipLoad - a boolean. If true, the returned Promise will be resolved before the load process is finished. If true, you will receive a “Loading node” instead of a “Loaded node”. Default: false


Return:

  • a Promise for a Node Object. Unless options.skipLoad is true, the Promise resolves after all data is downloaded and available for use.


Remarks:

  • The content of NodeDatabases opened by this function is stored separately per-room. Each room will have their own copy of the NodeDatabase identified by the “name”.
  • To open a room NodeDatabase, one of the following must be true:
    • The current user is a Gold subscriber; or
    • The room creator is a Platinum subscriber.


Example:


local promise = room:asyncOpenRoomNDB('myNDBId', {create=true});           

local node = await(promise);

-- variable node is ready to be used here


mesa:asyncOpenUserRoomNDB(name[, options])

Asynchronously open a per-user NodeDatabase within this room, which is physically stored on the Firecast server


Arguments:

  • name - A string identifying the remote user NodeDatabase in this room to be opened
  • (Optional) options - A Lua table describing additional settings that may contain:
    • create - a boolean. If true, the NodeDatabase can be created if it does not exist. Default: false.
    • skipLoad - a boolean. If true, the returned Promise will be resolved before the load process is finished. If true, you will receive a “Loading node” instead of a “Loaded node”. Default: false


Return:

  • a Promise for a Node Object. Unless options.skipLoad is true, the Promise resolves after all data is downloaded and available for use.


Remarks:

  • The content of NodeDatabases opened by this function is stored separately for each user and each room. Each user in the room will have their own copy of the NodeDatabase identified by the specified "name."


Example:


local promise = room:asyncOpenUserRoomNDB("myId", {create=true});

local node = await(promise);

-- variable node is ready to be used here



mesa:asyncOpenPVT(login[, params])

Asynchronously opens a private chat with the specified user within this room.


Arguments:

  • login - A string containing the username of the user you want to open the PVT Chat.

  • (Optional) params - A Lua table that may contain the following optional fields:
    • autoFocus - A Boolean; "true" means Firecast should try to focus the open interface, while "false" means to open without focusing it. Default: "false".

    • mode - One of the following strings:
      • "getOrCreate" - If the specified PVT chat already exists, it will be returned; otherwise, a new PVT chat interface will be created. This is the default mode.
      • "getOnly" - If the specified PVT chat already exists, it will be returned; otherwise, the promise returned by this function will be resolved to failure.


Return:


Example:


local room = Firecast.getRoomOf(sheet);

local promise = room:asyncOpenPVT("AlyssonRPG", {autoFocus=true});

local chat = await(promise);

chat:write("Hello!");


mesa:getChats()

Returns all chat objects that belong to this room.


Arguments:

None


Return:



Exemplos

Exemplo 1 - Exibindo uma mensagem com o nome e sistema de todas as mesas que o usuário está dentro.


local mesas = rrpg.getMesas();
local msg = ""; 

for i = 1, #mesas, 1 do
        local objMesa = mesas[i];      

        msg = msg .. objMesa.nome .. " (" .. objMesa.sistema .. ")\n";
end; 

if msg ~= "" then
        showMessage(msg);
else
        showMessage("O usuário não está em nenhuma mesa");
end;



Created with the Personal Edition of HelpNDoc: Easily create Qt Help files