Merge pull request #785 from dscarpac/seal-fix
Bugfix: updated issues with tokens sealing
This commit is contained in:
commit
cd694e04ea
@ -104,7 +104,9 @@ local tokenColor = {
|
|||||||
[""] = "#77674DE6"
|
[""] = "#77674DE6"
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSave() return JSON.encode(sealedTokens) end
|
function updateSave()
|
||||||
|
self.script_state = JSON.encode(sealedTokens)
|
||||||
|
end
|
||||||
|
|
||||||
function onLoad(savedData)
|
function onLoad(savedData)
|
||||||
sealedTokens = JSON.decode(savedData) or {}
|
sealedTokens = JSON.decode(savedData) or {}
|
||||||
@ -185,6 +187,7 @@ end
|
|||||||
|
|
||||||
function resetSealedTokens()
|
function resetSealedTokens()
|
||||||
sealedTokens = {}
|
sealedTokens = {}
|
||||||
|
updateSave()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- native event from TTS - used to update the context menu for cards like "Unrelenting"
|
-- native event from TTS - used to update the context menu for cards like "Unrelenting"
|
||||||
@ -228,6 +231,7 @@ function sealToken(name, playerColor)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
updateStackSize()
|
updateStackSize()
|
||||||
|
updateSave()
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@ -244,6 +248,7 @@ function releaseOneToken(playerColor)
|
|||||||
else
|
else
|
||||||
printToColor("Releasing token", playerColor)
|
printToColor("Releasing token", playerColor)
|
||||||
putTokenAway(table.remove(sealedTokens))
|
putTokenAway(table.remove(sealedTokens))
|
||||||
|
updateSave()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -262,6 +267,7 @@ function releaseMultipleTokens(playerColor)
|
|||||||
for i = 1, numRemoved do
|
for i = 1, numRemoved do
|
||||||
putTokenAway(table.remove(sealedTokens))
|
putTokenAway(table.remove(sealedTokens))
|
||||||
end
|
end
|
||||||
|
updateSave()
|
||||||
printToColor("Releasing " .. numRemoved .. " tokens", playerColor)
|
printToColor("Releasing " .. numRemoved .. " tokens", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -276,6 +282,7 @@ function releaseAllTokens(playerColor)
|
|||||||
putTokenAway(guid)
|
putTokenAway(guid)
|
||||||
end
|
end
|
||||||
sealedTokens = {}
|
sealedTokens = {}
|
||||||
|
updateSave()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -285,6 +292,7 @@ function returnMultipleTokens(playerColor)
|
|||||||
for i = 1, SHOW_MULTI_RETURN do
|
for i = 1, SHOW_MULTI_RETURN do
|
||||||
returnToken(table.remove(sealedTokens))
|
returnToken(table.remove(sealedTokens))
|
||||||
end
|
end
|
||||||
|
updateSave()
|
||||||
printToColor("Returning " .. SHOW_MULTI_RETURN .. " tokens", playerColor)
|
printToColor("Returning " .. SHOW_MULTI_RETURN .. " tokens", playerColor)
|
||||||
else
|
else
|
||||||
printToColor("Not enough tokens sealed.", playerColor)
|
printToColor("Not enough tokens sealed.", playerColor)
|
||||||
@ -331,6 +339,7 @@ function resolveSealed()
|
|||||||
local resolvedToken = getObjectFromGUID(guidToBeResolved)
|
local resolvedToken = getObjectFromGUID(guidToBeResolved)
|
||||||
resolvedToken.UI.setXml("")
|
resolvedToken.UI.setXml("")
|
||||||
updateStackSize()
|
updateStackSize()
|
||||||
|
updateSave()
|
||||||
chaosBagApi.drawChaosToken(mat, true, _, guidToBeResolved)
|
chaosBagApi.drawChaosToken(mat, true, _, guidToBeResolved)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user