added functionality to resolve specific tokens
This commit is contained in:
parent
8e1d4736fb
commit
67aff888b0
@ -33,7 +33,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": false,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"playercards/cards/BookofLivingMyths\")",
|
||||
"LuaScriptState": "",
|
||||
"MeasureMovement": false,
|
||||
"Name": "CardCustom",
|
||||
@ -58,5 +58,23 @@
|
||||
"scaleZ": 1
|
||||
},
|
||||
"Value": 0,
|
||||
"XmlUI": ""
|
||||
"XmlUI": "\u003cInclude src=\"playercards/BookofLivingMyths.xml\"/\u003e",
|
||||
"CustomUIAssets": [
|
||||
{
|
||||
"Type": 1,
|
||||
"Name": "font_teutonic-arkham",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2027213118467703445/89328E273B4C5180BF491516CE998DE3C604E162/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "resolve_bless",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2324488110706766387/EDC440CC9E6F1EDA73FB3A7B6DD1DE5ABDBD42D8/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "resolve_curse",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380783739898089676/02286A78E1F30A6A0E832F32271621ED5A2E987C/"
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": false,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"playercards/cards/NkosiMabati3\")",
|
||||
"LuaScriptState": "",
|
||||
"MeasureMovement": false,
|
||||
"Name": "Card",
|
||||
@ -58,5 +58,57 @@
|
||||
"scaleZ": 1
|
||||
},
|
||||
"Value": 0,
|
||||
"XmlUI": ""
|
||||
"XmlUI": "\u003cInclude src=\"playercards/NkosiMabati3.xml\"/\u003e",
|
||||
"CustomUIAssets": [
|
||||
{
|
||||
"Type": 1,
|
||||
"Name": "font_teutonic-arkham",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2027213118467703445/89328E273B4C5180BF491516CE998DE3C604E162/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "bless",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374775547028/7855033DE0EB1FDDF706E1303054D35FE0902532/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "curse",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374775547135/2360372CBE9452CB7B4D135BE13BBA6D46B7D427/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "skull",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374775547231/E0FEEF462DE4E7704832CA2415D0D027A6BF5041/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "autofail",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374792650351/EA4CE1F7A59E0B4CF5AD29DBCC40C8413DA14ADC/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "unnamed",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374792650571/E4C2B2B69282A4EE15FE290FF6B08BEFC8FCA65C/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "elderthing",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374792650683/1C046B6335317CA1AEBFC80645EEC18852D83D80/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "cultist",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374792650461/10D8037632900AA86045BDD42A564716D5855B1B/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "tablet",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374792650857/29DAE514E5C838C24C90ABBFFF92B1359B9A2F76/"
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Name": "frost",
|
||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2380784374792650766/73E07A50BE6FD9BED266F3421B472C4BF913DE81/"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ do
|
||||
end
|
||||
|
||||
-- called by playermats (by the "Draw chaos token" button)
|
||||
ChaosBagApi.drawChaosToken = function(mat, drawAdditional)
|
||||
return Global.call("drawChaosToken", {mat = mat, drawAdditional = drawAdditional})
|
||||
ChaosBagApi.drawChaosToken = function(mat, drawAdditional, tokenType, cardSealedToken)
|
||||
return Global.call("drawChaosToken", {mat = mat, drawAdditional = drawAdditional, tokenType = tokenType, sealedToken = guidToBeResolved})
|
||||
end
|
||||
|
||||
-- returns a Table List of chaos token ids in the current chaos bag
|
||||
|
@ -303,12 +303,36 @@ function drawChaosToken(params)
|
||||
|
||||
-- add the token to the list, compute new position based on list length
|
||||
tokenOffset[1] = tokenOffset[1] + (0.17 * #chaosTokens)
|
||||
local token = chaosBag.takeObject({
|
||||
index = 0,
|
||||
local tokenIndex = 0
|
||||
|
||||
if params.sealedToken then -- resolve a sealed token from a card
|
||||
|
||||
token = getObjectFromGUID(params.sealedToken)
|
||||
token.setPositionSmooth(params.mat.positionToWorld(tokenOffset))
|
||||
local guid = token.getGUID()
|
||||
local type = token.getName()
|
||||
if type == "Bless" or type == "Curse" then
|
||||
blessCurseManagerApi.releasedToken(type, guid)
|
||||
end
|
||||
tokenArrangerApi.layout()
|
||||
else -- take a token from the bag, either specified or random
|
||||
if params.tokenType then
|
||||
for i, lookedForToken in ipairs(chaosBag.getObjects()) do
|
||||
if lookedForToken.name == params.tokenType then
|
||||
tokenIndex = i - 1
|
||||
end
|
||||
end
|
||||
else
|
||||
tokenIndex = 0
|
||||
end
|
||||
|
||||
token = chaosBag.takeObject({
|
||||
index = tokenIndex,
|
||||
position = params.mat.positionToWorld(tokenOffset),
|
||||
rotation = params.mat.getRotation()
|
||||
})
|
||||
|
||||
end
|
||||
-- get data for token description
|
||||
local name = token.getName()
|
||||
local tokenData = mythosAreaApi.returnTokenData().tokenData or {}
|
||||
|
@ -77,7 +77,7 @@ local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
local tokenArrangerApi = require("accessories/TokenArrangerApi")
|
||||
|
||||
local sealedTokens = {}
|
||||
sealedTokens = {}
|
||||
local ID_URL_MAP = {}
|
||||
local tokensInBag = {}
|
||||
|
||||
|
107
src/playercards/cards/BookofLivingMyths.ttslua
Normal file
107
src/playercards/cards/BookofLivingMyths.ttslua
Normal file
@ -0,0 +1,107 @@
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
|
||||
|
||||
function onSave()
|
||||
return JSON.encode({ loopId = loopId })
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
if loadedData.loopId then
|
||||
currentState = "Empty"
|
||||
loopId = Wait.time(countBlessCurse, 1, -1)
|
||||
self.addContextMenuItem("Clear Helper", deleteButtons)
|
||||
end
|
||||
else
|
||||
self.addContextMenuItem("Enable Helper", createButtons)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function deleteButtons()
|
||||
self.UI.hide("bless_button")
|
||||
self.UI.hide("curse_button")
|
||||
self.UI.hide("both_buttons")
|
||||
self.clearContextMenu()
|
||||
self.addContextMenuItem("Enable Helper", createButtons)
|
||||
Wait.stop(loopId)
|
||||
loopId = nil
|
||||
end
|
||||
|
||||
-- Create buttons based on the button parameters
|
||||
function createButtons()
|
||||
self.clearContextMenu()
|
||||
self.addContextMenuItem("Clear Helper", deleteButtons)
|
||||
currentState = "Empty"
|
||||
loopId = Wait.time(countBlessCurse, 1, -1)
|
||||
|
||||
end
|
||||
|
||||
function resolveCurse()
|
||||
local closestMatColor = playmatApi.getMatColorByPosition(self.getPosition())
|
||||
log(closestMatColor)
|
||||
local mat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat")
|
||||
log(mat)
|
||||
tokenType = "Curse"
|
||||
|
||||
chaosBagApi.drawChaosToken(mat, true , tokenType)
|
||||
|
||||
end
|
||||
|
||||
function resolveBless()
|
||||
local closestMatColor = playmatApi.getMatColorByPosition(self.getPosition())
|
||||
--log(closestMatColor)
|
||||
local mat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat")
|
||||
--log(mat)
|
||||
tokenType = "Bless"
|
||||
--self.setRotationSmooth({0, 0, 0})
|
||||
chaosBagApi.drawChaosToken(mat, true , tokenType)
|
||||
|
||||
end
|
||||
|
||||
function countBlessCurse()
|
||||
-- count tokens in the bag and show appropriate button
|
||||
numInBag = { Bless = 0, Curse = 0 }
|
||||
local chaosBag = chaosBagApi.findChaosBag()
|
||||
local tokens = {}
|
||||
for _, v in ipairs(chaosBag.getObjects()) do
|
||||
if v.name == "Bless" then
|
||||
numInBag.Bless = numInBag.Bless + 1
|
||||
elseif v.name == "Curse" then
|
||||
numInBag.Curse = numInBag.Curse + 1
|
||||
end
|
||||
end
|
||||
|
||||
if numInBag.Bless > numInBag.Curse then
|
||||
if currentState ~= "More Bless" then
|
||||
self.UI.show("bless_button")
|
||||
self.UI.hide("curse_button")
|
||||
self.UI.hide("both_buttons")
|
||||
end
|
||||
currentState = "More Bless"
|
||||
elseif numInBag.Curse > numInBag.Bless then
|
||||
if currentState ~= "More Curse" then
|
||||
self.UI.show("curse_button")
|
||||
self.UI.hide("bless_button")
|
||||
self.UI.hide("both_buttons")
|
||||
end
|
||||
currentState = "More Curse"
|
||||
elseif numInBag.Curse == 0 then
|
||||
if currentState ~= "Empty" then
|
||||
self.UI.hide("both_buttons")
|
||||
self.UI.hide("bless_button")
|
||||
self.UI.hide("curse_button")
|
||||
end
|
||||
currentState = "Empty"
|
||||
else
|
||||
if currentState ~= "Equal" then
|
||||
self.UI.show("both_buttons")
|
||||
self.UI.hide("bless_button")
|
||||
self.UI.hide("curse_button")
|
||||
end
|
||||
currentState = "Equal"
|
||||
end
|
||||
end
|
@ -6,3 +6,26 @@ SHOW_SINGLE_RELEASE = true
|
||||
KEEP_OPEN = true
|
||||
|
||||
require("playercards/CardsThatSealTokens")
|
||||
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
local contextMenuAdded
|
||||
|
||||
|
||||
function onCollisionEnter()
|
||||
if contextMenuAdded then return end
|
||||
contextMenuAdded = true
|
||||
self.addContextMenuItem("Resolve sealed Curse", resolveSealed)
|
||||
end
|
||||
|
||||
function resolveSealed()
|
||||
if #sealedTokens == 0 then
|
||||
broadcastToAll("No tokens sealed.", "Red")
|
||||
return
|
||||
end
|
||||
local closestMatColor = playmatApi.getMatColorByPosition(self.getPosition())
|
||||
local mat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat")
|
||||
guidToBeResolved = table.remove(sealedTokens)
|
||||
chaosBagApi.drawChaosToken(mat, true, _, guidToBeResolved)
|
||||
end
|
@ -6,3 +6,26 @@ SHOW_SINGLE_RELEASE = true
|
||||
KEEP_OPEN = true
|
||||
|
||||
require("playercards/CardsThatSealTokens")
|
||||
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
local contextMenuAdded
|
||||
|
||||
|
||||
function onCollisionEnter()
|
||||
if contextMenuAdded then return end
|
||||
contextMenuAdded = true
|
||||
self.addContextMenuItem("Resolve sealed Bless", resolveSealed)
|
||||
end
|
||||
|
||||
function resolveSealed()
|
||||
if #sealedTokens == 0 then
|
||||
broadcastToAll("No tokens sealed.", "Red")
|
||||
return
|
||||
end
|
||||
local closestMatColor = playmatApi.getMatColorByPosition(self.getPosition())
|
||||
local mat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat")
|
||||
guidToBeResolved = table.remove(sealedTokens)
|
||||
chaosBagApi.drawChaosToken(mat, true, _, guidToBeResolved)
|
||||
end
|
45
src/playercards/cards/NkosiMabati3.ttslua
Normal file
45
src/playercards/cards/NkosiMabati3.ttslua
Normal file
@ -0,0 +1,45 @@
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
|
||||
|
||||
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())
|
||||
log(closestMatColor)
|
||||
local mat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat")
|
||||
log(mat)
|
||||
tokenType = sigil
|
||||
log("hello")
|
||||
log(tokenType)
|
||||
|
||||
local chaosbag = chaosBagApi.findChaosBag()
|
||||
for i, obj in ipairs(chaosbag.getObjects()) do
|
||||
if obj.name == tokenType then
|
||||
chaosBagApi.drawChaosToken(mat, true, tokenType, _)
|
||||
return
|
||||
end
|
||||
end
|
||||
broadcastToAll(tokenType .. " token not found in chaos bag", "Red")
|
||||
|
||||
end
|
@ -3,3 +3,25 @@ VALID_TOKENS = {
|
||||
}
|
||||
|
||||
require("playercards/CardsThatSealTokens")
|
||||
|
||||
local playmatApi = require("playermat/PlaymatApi")
|
||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||
local chaosBagApi = require("chaosbag/ChaosBagApi")
|
||||
local contextMenuAdded
|
||||
|
||||
function onCollisionEnter()
|
||||
if contextMenuAdded then return end
|
||||
contextMenuAdded = true
|
||||
self.addContextMenuItem("Resolve Elder Sign", resolveSealed)
|
||||
end
|
||||
|
||||
function resolveSealed()
|
||||
if #sealedTokens == 0 then
|
||||
broadcastToAll("No tokens sealed.", "Red")
|
||||
return
|
||||
end
|
||||
local closestMatColor = playmatApi.getMatColorByPosition(self.getPosition())
|
||||
local mat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, "Playermat")
|
||||
guidToBeResolved = table.remove(sealedTokens)
|
||||
chaosBagApi.drawChaosToken(mat, true, _, guidToBeResolved)
|
||||
end
|
40
xml/playercards/BookofLivingMyths.xml
Normal file
40
xml/playercards/BookofLivingMyths.xml
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
<Panel id="both_buttons" position="0 -50 -22"
|
||||
rotation="0 0 180"
|
||||
height="400" width="500"
|
||||
scale="0.25 0.25 1"
|
||||
showAnimation="FadeIn" hideAnimation="FadeOut" active="false">
|
||||
|
||||
<TableLayout cellSpacing="20" cellBackgroundColor="rgba(1,1,1,0)">
|
||||
<Row>
|
||||
<Cell><Button color="rgba(1,1,1,0)" icon="resolve_bless" onClick="resolveBless"></Button></Cell></Row>
|
||||
<Row><Cell><Button color="rgba(1,1,1,0)" icon="resolve_curse" onClick="resolveCurse"></Button></Cell>
|
||||
</Row>
|
||||
</TableLayout>
|
||||
</Panel>
|
||||
|
||||
<Panel id="curse_button" position="0 -50 -22"
|
||||
rotation="0 0 180"
|
||||
height="400" width="500"
|
||||
scale="0.25 0.25 1"
|
||||
showAnimation="FadeIn" hideAnimation="FadeOut" active="false">
|
||||
|
||||
<TableLayout cellSpacing="20" cellBackgroundColor="rgba(1,1,1,0)">
|
||||
<Row>
|
||||
<Cell><Button color="rgba(1,1,1,0)" icon="resolve_curse" onClick="resolveCurse"></Button></Cell>
|
||||
</Row>
|
||||
</TableLayout>
|
||||
</Panel>
|
||||
|
||||
<Panel id="bless_button" position="0 -50 -22"
|
||||
rotation="0 0 180"
|
||||
height="400" width="500"
|
||||
scale="0.25 0.25 1"
|
||||
showAnimation="FadeIn" hideAnimation="FadeOut" active="false">
|
||||
|
||||
<TableLayout cellSpacing="20" cellBackgroundColor="rgba(1,1,1,0)">
|
||||
<Row>
|
||||
<Cell><Button color="rgba(1,1,1,0)" icon="resolve_bless" onClick="resolveBless"></Button></Cell>
|
||||
</Row>
|
||||
</TableLayout>
|
||||
</Panel>
|
46
xml/playercards/NkosiMabati3.xml
Normal file
46
xml/playercards/NkosiMabati3.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<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="true">
|
||||
<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="true">
|
||||
|
||||
<TableLayout cellSpacing="20" cellBackgroundColor="rgba(1,1,1,0)">
|
||||
|
||||
<Row>
|
||||
<Cell><Button id="Bless" color="rgba(1,1,1,0)" icon="bless" onClick="chooseSigil"></Button></Cell>
|
||||
<Cell><Button id="Curse" color="rgba(1,1,1,0)" icon="curse" onClick="chooseSigil"></Button></Cell>
|
||||
<Cell><Button id="Skull" color="rgba(1,1,1,0)" icon="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="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="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="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>
|
Loading…
Reference in New Issue
Block a user