added option

This commit is contained in:
dscarpac 2024-09-22 22:10:37 -05:00
parent c20d747921
commit 327893e214
2 changed files with 22 additions and 3 deletions

View File

@ -33,6 +33,11 @@ SHOW_MULTI_RETURN --@type: number (amount of tokens to return to pool at once)
- fails if not enough tokens are sealed
- example usage: "Nephthys" (to return 3 bless tokens at once)
SHOW_RETURN_ALL --@boolean:
- enables an entry in the context menu
- this entry allows returning all sealed tokens to the token pool
- example usage: "Radiant Smite" (to return whatever number of bless tokens that are sealed at once)
SHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)
- enables an entry in the context menu
- this entry allows sealing of multiple tokens at once
@ -137,11 +142,14 @@ function generateContextMenu()
self.addContextMenuItem("Resolve " .. firstTokenType, resolveSealed)
end
-- conditional release option
if SHOW_MULTI_RETURN then
self.addContextMenuItem("Return " .. SHOW_MULTI_RETURN .. " token(s)", returnMultipleTokens)
end
if SHOW_RETURN_ALL then
self.addContextMenuItem("Return all tokens", returnAllTokens)
end
-- main context menu options to seal tokens
for _, map in pairs(ID_URL_MAP) do
if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then
@ -289,20 +297,30 @@ function releaseAllTokens(playerColor)
Player[playerColor].clearSelectedObjects()
end
-- returns multiple tokens at once to the token pool
-- returns multiple tokens at once to the token pool (with minimum)
function returnMultipleTokens(playerColor)
if SHOW_MULTI_RETURN <= #sealedTokens then
for i = 1, SHOW_MULTI_RETURN do
returnToken(table.remove(sealedTokens))
end
updateSave()
printToColor("Returning " .. SHOW_MULTI_RETURN .. " tokens", playerColor)
printToColor("Returning " .. SHOW_MULTI_RETURN .. " tokens to the token pool", playerColor)
else
printToColor("Not enough tokens sealed.", playerColor)
end
Player[playerColor].clearSelectedObjects()
end
-- returns all sealed tokens to the token pool
function returnAllTokens(playerColor)
printToColor("Returning " .. #sealedTokens .. " tokens to the token pool", playerColor)
for i = 1, #sealedTokens do
returnToken(table.remove(sealedTokens))
end
updateSave()
Player[playerColor].clearSelectedObjects()
end
-- returns the token (referenced by GUID) to the chaos bag
function putTokenAway(guid)
local token = getObjectFromGUID(guid)

View File

@ -4,5 +4,6 @@ VALID_TOKENS = {
KEEP_OPEN = true
MAX_SEALED = 3
SHOW_RETURN_ALL = true
require("playercards/CardsThatSealTokens")