version 1

This commit is contained in:
dscarpac 2024-03-06 11:00:10 -06:00
parent da9f955a59
commit a424400137
4 changed files with 199 additions and 2 deletions

View File

@ -238,5 +238,20 @@
"Name": "box-cover-mask-wide",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2115061298538827369/A20C2ECB8ECDC1B0AD8B2B38F68CA1C1F5E07D37/"
},
{
"Name": "token-skull",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374775547231/E0FEEF462DE4E7704832CA2415D0D027A6BF5041/"
},
{
"Name": "token-bless",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374775547028/7855033DE0EB1FDDF706E1303054D35FE0902532/"
},
{
"Name": "token-curse",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374775547135/2360372CBE9452CB7B4D135BE13BBA6D46B7D427/"
}
]

View File

@ -33,7 +33,7 @@
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScript": "require(\"playercards/cards/NkosiMabati3\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Card",
@ -58,5 +58,5 @@
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"XmlUI": "\u003cInclude src=\"playercards/NkosiMabati3.xml\"/\u003e"
}

View File

@ -0,0 +1,110 @@
local playmatApi = require("playermat/PlaymatApi")
local guidReferenceApi = require("core/GUIDReferenceApi")
local chaosBagApi = require("chaosbag/ChaosBagApi")
function onSave()
return JSON.encode()
end
function onLoad(savedData)
self.addContextMenuItem("Enable Helper", createButtons)
self.addContextMenuItem("Clear Helper", deleteButtons)
end
-- Create buttons to choose sigil
function createButtons()
self.clearContextMenu()
self.addContextMenuItem("Clear Helper", deleteButtons)
self.UI.show("choose")
self.UI.show("sigils")
end
-- Delete button and remove sigil
function deleteButtons()
self.clearContextMenu()
self.addContextMenuItem("Enable Helper", createButtons)
self.UI.hide("resolve_skull")
end
function chooseSigil(_,_,id)
if id == "Bless" then
sigil = "Bless"
self.UI.hide("sigils")
self.UI.hide("choose")
self.UI.show("resolve_bless")
elseif id == "Curse" then
sigil = "Curse"
self.UI.hide("sigils")
self.UI.hide("choose")
self.UI.show("resolve_curse")
else
sigil = "Skull"
self.UI.hide("sigils")
self.UI.hide("choose")
self.UI.show("resolve_skull")
end
log("Sigil is " .. sigil)
end
function resolveSigil()
local closestMatColor = playmatApi.getMatColorByPosition(self.getPosition())
local mat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat")
tokenType = sigil
local tokensInPlay = chaosBagApi.getTokensInPlay()
local chaosbag = chaosBagApi.findChaosBag()
for i, obj in ipairs(chaosbag.getObjects()) do
-- if there are any sigils in the bag
log(obj.name)
if obj.name == tokenType then
log(tokensInPlay)
if tokensInPlay ~= nil then
for j, token in ipairs(tokensInPlay) do
if token.getName() == "Cultist" then
-- draw XML to return token to bag
token.UI.setXmlTable({
{
tag="HorizontalLayout",
attributes={
height=200,
width=600,
scale="0.3 0.3 1",
rotation="0 0 180",
position="0 120 -22",
color="rgba(0,0,0,0.7)",
},
children={
{
tag="Button",
attributes={
fontSize=100,
color="White",
},
id="hi",
value="Nkosi React",
onClick="drawSigil",
},
}
}
})
return
end
end
broadcastToAll("Cultist token not found in play area", "Red")
return
end
end
end
broadcastToAll(tokenType .. " token not found in chaos bag", "Red")
end
function drawSigil(_,_,id)
log(id)
--chaosBagApi.returnChaosTokenToBag(token)
tokenType = "Skull"
chaosBagApi.drawChaosToken(mat, true, tokenType, _)
end

View File

@ -0,0 +1,72 @@
<Panel id="choose" position="0 -90 -22"
rotation="0 0 180"
height="200" width="500"
scale="0.3 0.3 1"
showAnimation="FadeIn" hideAnimation="FadeOut" active="false">
<Text font="font_teutonic-arkham" fontSize="100" color="White" outline="Black" outlineSize="2, -2">Choose sigil:</Text>
</Panel>
<Panel id="sigils" position="0 -50 -22"
rotation="0 0 180"
height="200" width="500"
scale="0.3 0.3 1"
showAnimation="FadeIn" hideAnimation="FadeOut" active="false">
<TableLayout cellSpacing="20" cellBackgroundColor="rgba(1,1,1,0)">
<Row>
<Cell><Button id="Bless" color="rgba(1,1,1,0)" icon="token-bless" onClick="chooseSigil"></Button></Cell>
<Cell><Button id="Curse" color="rgba(1,1,1,0)" icon="token-curse" onClick="chooseSigil"></Button></Cell>
<Cell><Button id="Skull" color="rgba(1,1,1,0)" icon="token-skull" onClick="chooseSigil"></Button></Cell>
</Row>
</TableLayout>
</Panel>
<Panel id="resolve_bless"
position="0 -30 -22"
rotation="0 0 180"
height="500" width="1000"
scale="0.1 0.1 1" active="false" showAnimation="FadeIn" hideAnimation="FadeOut"
><Button icon="token-bless" font="font_teutonic-arkham" fontSize="200" textColor="Red"
onClick="resolveSigil" color="rgba(1,1,1,0)" iconAlignment="Right">Resolve </Button></Panel>
<Panel id="resolve_skull"
position="0 -30 -22"
rotation="0 0 180"
height="500" width="1000"
scale="0.1 0.1 1" active="false" showAnimation="FadeIn" hideAnimation="FadeOut"
><Button icon="token-skull" font="font_teutonic-arkham" fontSize="200" textColor="Red"
onClick="resolveSigil" color="rgba(1,1,1,0)" iconAlignment="Right">Resolve </Button></Panel>
<Panel id="resolve_curse"
position="0 -40 -22"
rotation="0 0 180"
height="500" width="1400"
scale="0.1 0.1 1" active="false" showAnimation="FadeIn" hideAnimation="FadeOut"
><Button icon="token-curse" font="font_teutonic-arkham" fontSize="260" textColor="White"
onClick="resolveSigil" color="rgba(1,1,1,0)" iconAlignment="Right" padding="40 40 0 0">Resolve</Button></Panel>
<Defaults>
<Button padding="50 50 50 50"
font="font_teutonic-arkham"
fontSize="300"
iconWidth="400"
iconAlignment="Right"/>
<Panel position="0 -55 -22"
rotation="0 0 180"
height="450" width="1400"
scale="0.1 0.1 1"/>
<TableLayout active="false"
cellSpacing="80"
cellBackgroundColor="rgba(1,1,1,0)"/>
</Defaults>
<Panel>
<TableLayout id="resolve_skull">
<Row>
<Cell>
<Button id="Bless" icon="token-skull" textColor="White"
onClick="resolveSigil" color="#4A0400E6" iconAlignment="Right">Resolve</Button>
</Cell>
</Row>
</TableLayout>
</Panel>