Objeto BibliotecaItem

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

Objeto BibliotecaItem

Este objeto representa um item na biblioteca de uma mesa no RRPG Firecast.


Herança

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


Características

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

Propriedades e atributos

Propriedade

Tipo

Descrição

room

mesa

Objeto Mesa

Somente leitura, contém o Objeto Mesa que representa em qual mesa este item está.


parent

pai

Objeto BibliotecaItem


Somente leitura, contém o objeto BibliotecaItem que é pai deste item.


Observação: Se o item for raiz da biblioteca, esta propriedade conterá nil.


children

filhos

Arranjo de Objeto BibliotecaItem

Contém um arranjo de Objetos BibliotecaItem representando os sub-itens deste item.


Um arranjo é uma tabela lua indexada de 1 a N.


tipo

Enumerado:

  • "biblioteca"
  • "diretorio"
  • "personagem"
  • "imagem"
  • "sceneUnitClass"
  • "scene2"
  • "scene3"

Somente leitura, contém que tipo de item este é.


"biblioteca" - diretório raiz da biblioteca.

"diretorio" - uma pasta na biblioteca

"personagem" - Um personagem

"imagem" - Uma imagem (implementação futura)


"sceneUnitClass" - Um item do Scene2


"scene2" - Um tabuleiro de Scene 2


"scene3" - Um tabuleiro/grid de Scene 3


codigoInterno

Integer

Somente Leitura, contém o código interno que identifica este item de biblioteca unicamente no RRPG Firecast.


name

nome

String

Somente leitura, contém o nome do item da biblioteca.


Para alterar esta propriedade, utilize o método asyncUpdate deste objeto.


firecastURI

String

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


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


ownerLogin

loginDono

String

Somente leitura, contém o login Firecast do usuário que é dono deste item.


Para alterar esta propriedade, utilize o método asyncUpdate deste objeto.


owner

dono

Objeto Jogador

Somente leitura, contém o o objeto Jogador do dono deste item.


Observação: Se o dono não estiver na mesa no momento, esta propriedade conterá nil. Utilize a propriedade "loginDono" para descobrir o login do dono mesmo se ele não estiver na mesa.


creatorLogin

loginCriador

String

Somente leitura, contém o login do usuário que criou este item.


creator

criador

Objeto Jogador

Somente leitura, contém o objeto Jogador do usuário que criou este item.


Observação: Se o criador não estiver na mesa no momento, esta propriedade conterá nil. Utilize a propriedade "loginCriador" se você quiser descobrir quem criou o item mesmo se ele não estiver na mesa.


visible

visivel

Boolean

Somente leitura, contém true se o item estiver marcado para ser visível a todos da mesa.


Observação: Esta propriedade pode conter true mas o item não estar de fato visível a todos. Isto ocorre quando o item está dentro de um item pai que está escondido.


Para descobrir se o item está realmente visível a todos, utilize a propriedade "visivelRecursivamente".


Para alterar esta propriedade, utilize o método asyncUpdate deste objeto.


recursiveVisible

visivelRecursivamente

Boolean

Somente leitura, contém true se o item está realmente visível a todos da mesa.




Métodos


Método

Descrição

bibliotecaItem:asyncCreateChar(charParams)

Asynchronously creates a character in the room.


Parameters:

  • charParams - A Lua table with the following fields:
    • name - String containing the name of the new character to be created.

    • dataType - String identifying the sheet template the new character will use. Refer to forms dataType for details.

    • (Optional) visible - A boolean value; set to true if the new character should be visible to all, false otherwise. Default: true.

    • (Optional) ownerLogin - A string containing the user account name that will own the new character. nil designates an NPC. Default: nil


Returns:

Remarks:

  • The character will be created within the 'BibliotecaItem' object that received the function call

  • This function is only applicable if the 'BibliotecaItem' object receiving the function call has the attribute "tipo" set to "diretorio" or "biblioteca".


bibliotecaItem:asyncCreateDir(dirParams)

Asynchronously creates a directory in the room llibrary.


Parameters:

  • dirParams - A table with the following fields:
    • name - String containing the name of the new directory to be created.

    • (Optional) visible - A boolean value; set to true if the new directory should be visible to all, false otherwise. Default: true.


Returns:

Remarks:

  • The directory will be created within the 'BibliotecaItem' object that received the function call

  • This function is only applicable if the 'BibliotecaItem' object receiving the function call has the attribute "tipo" set to "diretorio" or "biblioteca".


bibliotecaItem:asyncCreateScene3(gridParams)

Asynchronously creates a grid in the room.


Parameters:

  • gridParams - A table with the following fields:
    • name - String containing the name of the new grid to be created.

    • (Optional) visible - A boolean value; set to true if the new grid should be visible to all, false otherwise. Default: true.


Returns:

Remarks:

  • The grid will be created within the 'BibliotecaItem' object that received the function call

  • This function is only applicable if the 'BibliotecaItem' object receiving the function call has the attribute "tipo" set to "diretorio" or "biblioteca".


bibliotecaItem:asyncDelete()

Asynchronously delete this bibliotecaItem.


Parameters:

None

Returns:

  • A promise that tracks the asynchronous process.


bibliotecaItem:asyncMoveTo(newParent)


Asynchronously move this BibliotecaItem to a new location in the library tree hierarchy.


Parameters:

Returns:

  • A promise that tracks the asynchronous process.


Remarks

  • This operation only works if the newParent parameter has the attribute "tipo" set to "diretorio" or "biblioteca"."


bibliotecaItem:asyncUpdate(changes)

Asynchronously update the attributes of this BibliotecaItem. 


Parameters:

  • changes - A table representing the attributes you wish to modify. It may contain the following fields:
    • (Optional) name - String containing the new name for this BibliotecaItem.

    • (Optional) visible - A boolean value; set to true if the BibliotecaItem should be visible to all, false otherwise.

    • (Optional) editionBlocked - A boolean value; set to true if character edition should be blocked, false otherwise. Only applicable to characters.

    • (Optional) ownerLogin - A string containing the user account name that will own the character. Use an empty string "" to designate an NPC. Only applicable to characters.

    • (Optional) bar0Val
      (Optional) bar1Val
      (Optional) bar2Val
      (Optional) bar3Val  - A number, representing the new current value for the corresponding character bar. Only applicable to characters.

    • (Optional) bar0Max
      (Optional) bar1Max
      (Optional) bar2Max
      (Optional) bar3Max - A number, indicating the new maximum value for the corresponding character bar. Only applicable to characters.

    • (Optional) edtLine0
      (Optional) edtLine1 - A string, indicating the new content for the corresponding character editable line. Only applicable to characters.

    • (Optional) avatar - A string, denoting the new image URL for the character avatar. Only applicable to characters.


Returns

  • A promise that tracks the asynchronous process.


Remarks:

  • All fields inside "changes" parameter are optional. Its presence means you want to change that attribute while its absence means to keep it unchanged.


bibliotecaItem:isType(typeName)


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



Exemplos

Exemplo 1 - Obter todos os nomes de todos os itens na biblioteca de uma mesa


local function obterNomesRecursivo(bibItem)
        local itensFilhos = bibItem.children;
        local nomes = bibItem.name;                    
        local i;       

        for i = 1, #itensFilhos, 1 do
                local bibItemFilho = itensFilhos[i];                                 
                local nomesDoFilho = obterNomesRecursivo(bibItemFilho) or "";    

                if nomesDoFilho ~= "" then
                        nomes = nomes .. "\n" .. nomesDoFilho;
                end;
        end;       

        return nomes;
end; 

local nomesDeTodosOsItens = obterNomesRecursivo(umObjetoMesa.biblioteca);   
showMessage(nomesDeTodosOsItens);


       


Created with the Personal Edition of HelpNDoc: Elevate Your Help Documentation with a Help Authoring Tool