Merge pull request #881 from dscarpac/smite-seal
Added Return All Sealed Tokens option
This commit is contained in:
commit
be598c4c93
@ -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
|
- fails if not enough tokens are sealed
|
||||||
- example usage: "Nephthys" (to return 3 bless tokens at once)
|
- 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)
|
SHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)
|
||||||
- enables an entry in the context menu
|
- enables an entry in the context menu
|
||||||
- this entry allows sealing of multiple tokens at once
|
- this entry allows sealing of multiple tokens at once
|
||||||
@ -137,11 +142,14 @@ function generateContextMenu()
|
|||||||
self.addContextMenuItem("Resolve " .. firstTokenType, resolveSealed)
|
self.addContextMenuItem("Resolve " .. firstTokenType, resolveSealed)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- conditional release option
|
|
||||||
if SHOW_MULTI_RETURN then
|
if SHOW_MULTI_RETURN then
|
||||||
self.addContextMenuItem("Return " .. SHOW_MULTI_RETURN .. " token(s)", returnMultipleTokens)
|
self.addContextMenuItem("Return " .. SHOW_MULTI_RETURN .. " token(s)", returnMultipleTokens)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if SHOW_RETURN_ALL then
|
||||||
|
self.addContextMenuItem("Return all tokens", returnAllTokens)
|
||||||
|
end
|
||||||
|
|
||||||
-- main context menu options to seal tokens
|
-- main context menu options to seal tokens
|
||||||
for _, map in pairs(ID_URL_MAP) do
|
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
|
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()
|
Player[playerColor].clearSelectedObjects()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- returns multiple tokens at once to the token pool
|
-- returns multiple tokens at once to the token pool (with minimum)
|
||||||
function returnMultipleTokens(playerColor)
|
function returnMultipleTokens(playerColor)
|
||||||
if SHOW_MULTI_RETURN <= #sealedTokens then
|
if SHOW_MULTI_RETURN <= #sealedTokens then
|
||||||
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()
|
updateSave()
|
||||||
printToColor("Returning " .. SHOW_MULTI_RETURN .. " tokens", playerColor)
|
printToColor("Returning " .. SHOW_MULTI_RETURN .. " tokens to the token pool", playerColor)
|
||||||
else
|
else
|
||||||
printToColor("Not enough tokens sealed.", playerColor)
|
printToColor("Not enough tokens sealed.", playerColor)
|
||||||
end
|
end
|
||||||
Player[playerColor].clearSelectedObjects()
|
Player[playerColor].clearSelectedObjects()
|
||||||
end
|
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
|
-- returns the token (referenced by GUID) to the chaos bag
|
||||||
function putTokenAway(guid)
|
function putTokenAway(guid)
|
||||||
local token = getObjectFromGUID(guid)
|
local token = getObjectFromGUID(guid)
|
||||||
|
@ -4,5 +4,6 @@ VALID_TOKENS = {
|
|||||||
|
|
||||||
KEEP_OPEN = true
|
KEEP_OPEN = true
|
||||||
MAX_SEALED = 3
|
MAX_SEALED = 3
|
||||||
|
SHOW_RETURN_ALL = true
|
||||||
|
|
||||||
require("playercards/CardsThatSealTokens")
|
require("playercards/CardsThatSealTokens")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user