Skip to content

Commit

Permalink
Scene in Lua
Browse files Browse the repository at this point in the history
* Added get token name on drag url with character

Lista de PdMs & Gerenciador de Campanha & Ficha de Reinos d20
* Added character data to image drag
* Added roll macro from pdm

Updated macros on some sheets to use with lista de pdms
  • Loading branch information
ViniciusDinizLima committed May 18, 2024
1 parent 1acf362 commit 090b95e
Show file tree
Hide file tree
Showing 51 changed files with 5,572 additions and 4,378 deletions.
Binary file modified Plugins/Core/sceneinlua/output/sceneinlua.rpk
Binary file not shown.
1 change: 1 addition & 0 deletions Plugins/Core/sceneinlua/rrpgScene_DragDrop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ local function adicionarUmTokenDeUmURL(scene, url, x, y, drag, autoPlace)

if per ~= nil then
token.ownerCharacter = per.codigoInterno;
token.name = per.name
end;

local jogador = drag:getData("player");
Expand Down
140 changes: 92 additions & 48 deletions Plugins/Sheets/Ficha Pathfinder/addMacros.lua
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
--Add Macros code
local version = 1
local version = 2

local ataqText = [[
-- USO: /ataq <Nº do ataque> <Filtro>
-- /ataq ou /atq <numero (opcional) <filtro npc|pc|pcOnline|all|mine (opcional)>", descricao="Ficha Pathfinder. Ao usar /per (sem parametros) abre um popup para selecionar um ataque avançado. Será feito o ataque com o personagem mais recentemente atribuido. Ao usar /per acompanhado de um numero e sem um filtro, o ataque naquela posição será realizado. Ao usar /per acompanhado de um valor (use -1 se quiser selecionar o ataque na janela pop up) e um parametro de filtro é aberta uma janela para selecionar um personagem para realizar o ataque.
-- /ataq ou /atq <numero (opcional) <filtro npc|pc|pcOnline|all|mine (opcional)>
-- PREPARE ARGS
if parametro~="" and parametro~=nil and #arg==0 then
--write("param != arg")
--write(parametro)
arg = {};
local index = 0;
for i in string.gmatch(parametro, "%S+") do
index = index + 1;
arg[index] = i;
index = index + 1;
arg[index] = i;
end
end
local indice = tonumber(arg[1])
local texto = ""
local filter = arg[2]
local personagem = sheet
-- FIND SHEET
local personagem
if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" then
personagem = getCharacterSheet(chooseCharacter("Qual personagem deseja usar para atacar?", filter))
personagem = getCharacterSheet(chooseCharacter("Qual personagem deseja usar?", filter))
elseif filter == "mine" then
personagem = getCharacterSheet(chooseCharacterOfPlayer("Qual personagem deseja usar para atacar?", myPlayer))
personagem = getCharacterSheet(chooseCharacterOfPlayer("Qual personagem deseja usar?", myPlayer))
elseif filter ~= nil and filter ~= "" then
-- try to find by id
local bibItem = chat.room:findBibliotecaItem(filter)
if bibItem then personagem = getCharacterSheet(bibItem) end
end
if personagem == nil then
-- nothing from filter, use default sheet
personagem = sheet
end
-- ROLL ATTACK
local ataques = ndb.getChildNodes(personagem.campoDosAtaques)
local lista = {}
for i=1, #ataques, 1 do
Expand Down Expand Up @@ -84,30 +94,39 @@ end

local perText = [[
-- USO: /per <Nome da Pericia> <Filtro>
-- /per <numero ou nome (opcional)> <filtro npc|pc|pcOnline|all|mine (opcional)>", descricao="Ficha Pathfinder. Ao usar /per (sem parametros) abre um popup para selecionar um teste de pericia. Será feito o teste de atributo do personagem mais recentemente atribuido. Ao usar /per acompanhado de um numero e sem um filtro o teste da pericia naquela posição da ficha será realizado. Ao usar /per acompanhado do nome da pericia o teste daquela pericia será realizado. Tente por o nome da pericia parecido com como está na ficha. O macro vai tentar ignorar letras maiusculas, acentos e outros. Ao usar /per acompanhado de um valor (numero ou nome, use -1 se quiser selecionar a pericia na janela pop up) e um parametro de filtro é aberta uma janela para selecionar um personagem para realizar o teste.
-- /per <numero ou nome (opcional)> <filtro npc|pc|pcOnline|all|mine (opcional)
-- PREPARE ARGS
if parametro~="" and parametro~=nil and #arg==0 then
--write("param != arg")
--write(parametro)
arg = {};
local index = 0;
for i in string.gmatch(parametro, "%S+") do
index = index + 1;
arg[index] = i;
index = index + 1;
arg[index] = i;
end
end
local indice = tonumber(arg[1])
local nome = parametro
local texto = ""
local filter = arg[#arg]
local personagem = sheet
if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" or filter=="mine" then
if filter=="mine"then
personagem = getCharacterSheet(chooseCharacterOfPlayer("Qual personagem deseja usar para o teste?", myPlayer))
else
personagem = getCharacterSheet(chooseCharacter("Qual personagem deseja usar para o teste?", filter))
end
-- Atualizando o nome da pericia pra remover o filtro
-- FIND SHEET
local personagem
if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" then
personagem = getCharacterSheet(chooseCharacter("Qual personagem deseja usar?", filter))
elseif filter == "mine" then
personagem = getCharacterSheet(chooseCharacterOfPlayer("Qual personagem deseja usar?", myPlayer))
elseif filter ~= nil and filter ~= "" then
-- try to find by id
local bibItem = chat.room:findBibliotecaItem(filter)
if bibItem then personagem = getCharacterSheet(bibItem) end
end
if personagem == nil then
-- nothing from filter, use default sheet
personagem = sheet
else
-- Found a sheet with filter
-- so, remove filter from possible skill name
local size = #arg-1
nome = ""
for i=1, size, 1 do
Expand All @@ -117,7 +136,7 @@ if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" or
end
end
end
-- FIND SKILL
local pericias = ndb.getChildNodes(personagem.campoDasPericias)
local lista = {}
for i=1, #pericias, 1 do
Expand All @@ -126,44 +145,52 @@ for i=1, #pericias, 1 do
indice = i
end
end
if indice == nil or indice < 1 or indice > #pericias then
indice, texto = choose("Que teste deseja fazer?", lista, 1)
end
-- ROLL
local teste = "1d20+"
teste = teste .. (tonumber(pericias[indice].totalPericia) or 0)
rolar(teste, "Teste de " .. lista[indice] .. " de " .. (personagem.nome or "Nome"))
]]

local atrText = [[
-- USO: /atr <Nº do atributo 1:6> <filtro>
-- /atr <numero 1 a 6 (opcional)> <filtro npc|pc|pcOnline|all|mine (opcional)>", descricao="Ficha Pathfinder. Ao usar /atr (sem parametros) abre um popup para selecionar um teste de resistencia. Será feito o teste de atributo do personagem mais recentemente atribuido. Ao usar /atr acompanhado de um numero e sem um filtro o teste de atributo (1: FOR, 2: DES, 3: CON, 4: INT, 5: SAB, 6:CAR) é feito para o personagem mais recentemente atribuido. Ao usar /atr acompanhado de um valor (use -1 se quiser selecionar o atributo na janela pop up) e um parametro de filtro é aberta uma janela para selecionar um personagem para realizar o teste.
-- /atr <numero 1 a 6 (opcional)> <filtro npc|pc|pcOnline|all|mine (opcional)
-- PREPARE ARGS
if parametro~="" and parametro~=nil and #arg==0 then
--write("param != arg")
--write(parametro)
arg = {};
local index = 0;
for i in string.gmatch(parametro, "%S+") do
index = index + 1;
arg[index] = i;
index = index + 1;
arg[index] = i;
end
end
local indice = tonumber(arg[1])
local texto = ""
local filter = arg[2]
local personagem = sheet
-- FIND SHEET
local personagem
if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" then
personagem = getCharacterSheet(chooseCharacter("Qual personagem deseja usar?", filter))
elseif filter == "mine" then
personagem = getCharacterSheet(chooseCharacterOfPlayer("Qual personagem deseja usar?", myPlayer))
elseif filter ~= nil and filter ~= "" then
-- try to find by id
local bibItem = chat.room:findBibliotecaItem(filter)
if bibItem then personagem = getCharacterSheet(bibItem) end
end
if personagem == nil then
-- nothing from filter, use default sheet
personagem = sheet
end
-- FIND ATTRIBUTE
if indice == nil or indice < 1 or indice > 6 then
indice, texto = choose("Que teste deseja fazer?", {"Força", "Destreza", "Constituição", "Inteligência", "Sabedoria", "Carisma"}, 1)
end
-- ROLL
local teste = "1d20+"
if indice == 1 then
teste = teste .. (tonumber(personagem.efetModFor) or 0)
Expand All @@ -188,32 +215,41 @@ end

local trText = [[
-- USO: /tr <Nº do TR 1:3> <filtro>
-- /tr <numero 1 a 3 (opcional)> <filtro npc|pc|pcOnline|all|mine (opcional)>", descricao="Ficha Pathfinder. Ao usar /tr (sem parametros) abre um popup para selecionar um teste de resistencia. Será feito o teste de resistência do personagem mais recentemente atribuido. Ao usar /tr acompanhado de um numero e sem um filtro o teste de resistencia (1: fortitude, 2: reflexos, 3: vontade) é feito para o personagem mais recentemente atribuido. Ao usar /tr acompanhado de um valor (use -1 se quiser selecionar a resistencia na janela pop up) e um parametro de filtro é aberta uma janela para selecionar um personagem para realizar o teste.
-- /tr <numero 1 a 3 (opcional)> <filtro npc|pc|pcOnline|all|mine (opcional)
-- PREPARE ARGS
if parametro~="" and parametro~=nil and #arg==0 then
--write("param != arg")
--write(parametro)
arg = {};
local index = 0;
for i in string.gmatch(parametro, "%S+") do
index = index + 1;
arg[index] = i;
index = index + 1;
arg[index] = i;
end
end
local indice = tonumber(arg[1])
local texto = ""
local filter = arg[2]
local personagem = sheet
if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" then
-- FIND SHEET
local personagem
if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" then
personagem = getCharacterSheet(chooseCharacter("Qual personagem deseja usar?", filter))
elseif filter == "mine" then
elseif filter == "mine" then
personagem = getCharacterSheet(chooseCharacterOfPlayer("Qual personagem deseja usar?", myPlayer))
elseif filter ~= nil and filter ~= "" then
-- try to find by id
local bibItem = chat.room:findBibliotecaItem(filter)
if bibItem then personagem = getCharacterSheet(bibItem) end
end
if personagem == nil then
-- nothing from filter, use default sheet
personagem = sheet
end
-- FIND SAVE
if indice == nil or indice < 1 or indice > 3 then
indice, texto = choose("Que teste deseja fazer?", {"Fortitude", "Reflexos", "Vontade"}, 1)
end
-- ROLL
local teste = "1d20+"
if indice == 1 then
teste = teste .. (tonumber(personagem.trFort) or 0)
Expand All @@ -229,27 +265,35 @@ end

local iniText = [[
-- USO: /ini <filtro>
-- /ini <filtro npc|pc|pcOnline|all|mine (opcional)>", descricao="Ficha Pathfinder. Ao usar /ini (sem parametros) a iniciativa do personagem mais recentemente atribuido é rolada. Ao usar /per acompanhado de um filtro é aberta uma janela para selecionar um personagem para rolar a iniciativa.
-- /ini <filtro npc|pc|pcOnline|all|mine (opcional)
-- PREPARE ARGS
if parametro~="" and parametro~=nil and #arg==0 then
--write("param != arg")
--write(parametro)
arg = {};
local index = 0;
for i in string.gmatch(parametro, "%S+") do
index = index + 1;
arg[index] = i;
index = index + 1;
arg[index] = i;
end
end
local filter = arg[1]
local personagem = sheet
if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" then
-- FIND SHEET
local personagem
if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" then
personagem = getCharacterSheet(chooseCharacter("Qual personagem deseja usar?", filter))
elseif filter == "mine" then
elseif filter == "mine" then
personagem = getCharacterSheet(chooseCharacterOfPlayer("Qual personagem deseja usar?", myPlayer))
elseif filter ~= nil and filter ~= "" then
-- try to find by id
local bibItem = chat.room:findBibliotecaItem(filter)
if bibItem then personagem = getCharacterSheet(bibItem) end
end
if personagem == nil then
-- nothing from filter, use default sheet
personagem = sheet
end
-- ROLL
local teste = "1d20+"
teste = teste .. (tonumber(personagem.iniciativa) or 0)
rolar(teste, "Iniciativa de " .. (personagem.nome or "Nome"))
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Sheets/Ficha Pathfinder/module.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module sdkVersion="3.7">
<id>FICHA_PATHFINDER</id>
<version>1.0</version>
<version>1.1</version>
<info lang="pt-BR">
<!--Informações do plugin na língua "pt-BR". Você pode ter várias tags "info", uma para cada tradução que quiser.-->
<name>Ficha Pathfinder</name>
Expand Down
Binary file modified Plugins/Sheets/Ficha Pathfinder/output/Ficha Pathfinder.rpk
Binary file not shown.
Loading

0 comments on commit 090b95e

Please sign in to comment.