-- Bundled by luabundle {"version":"1.6.0"} local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire) local loadingPlaceholder = {[{}] = true} local register local modules = {} local require local loaded = {} register = function(name, body) if not modules[name] then modules[name] = body end end require = function(name) local loadedModule = loaded[name] if loadedModule then if loadedModule == loadingPlaceholder then return nil end else if not modules[name] then if not superRequire then local identifier = type(name) == 'string' and '\"' .. name .. '\"' or tostring(name) error('Tried to require ' .. identifier .. ', but no such module has been registered') else return superRequire(name) end end loaded[name] = loadingPlaceholder loadedModule = modules[name](require, loaded, register, modules) loaded[name] = loadedModule end return loadedModule end return require, loaded, register, modules end)(nil) __bundle_register("core/OptionPanelApi", function(require, _LOADED, __bundle_register, __bundle_modules) do local OptionPanelApi = {} -- loads saved options ---@param options table Set a new state for the option table OptionPanelApi.loadSettings = function(options) return Global.call("loadSettings", options) end ---@return any: Table of option panel state OptionPanelApi.getOptions = function() return Global.getTable("optionPanel") end return OptionPanelApi end end) __bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules) require("playercards/cards/ThirdTimesaCharm") end) __bundle_register("playercards/cards/ThirdTimesaCharm", function(require, _LOADED, __bundle_register, __bundle_modules) require("playercards/CardsWithHelper") require("playercards/CardsThatRedrawTokens") end) __bundle_register("playercards/CardsThatRedrawTokens", function(require, _LOADED, __bundle_register, __bundle_modules) --[[ Library for cards that return and redraw tokens This file is used to add an XML button to a card, turned on via context menu. Valid options modify the appearance of the XML button, as well as the behavior of the return and redraw function. Set options before requiring this file. Parameters for the return and redraw functions. Typically set VALID_TOKENS or INVALID_TOKENS, not both. If there are no restrictions on which tokens can be redrawn (e.g. Wendy Adams), keep both empty. * VALID_TOKENS --@type table - keyed table which lists all tokens that can be redrawn by the card - example usage: "False Covenant" > VALID_TOKENS = { > ["Curse"] = true > } * INVALID_TOKENS --@type table - keyed table which lists all tokens that cannot be redrawn by the card - example usage: "Custom Ammunition" > INVALID_TOKENS = { > ["Auto-fail"] = true > } * DRAW_SPECIFIC_TOKEN --@type string (name of token or nil) - if set, will attempt to draw that specific token * RETURN_TO_POOL --@type string - allows for the name of the card to be passed onto Global for any special handling The following parameters modify the appearence of the XML button and are not listed as part of a table. - buttonHeight (default is 450) - buttonWidth (default is 1400) - buttonPosition (default is "0 -55 -22") - buttonFontSize (default is 250) - buttonRotation (change if button is placed on an investigator cards) - buttonLabel (default is "Redraw Token") - buttonIcon (to add an icon to the right) - buttonColor (default is "#77674DE6") ---------------------------------------------------------- EXAMPLE: Claypool's Furs This card can only redraw the Frost token, and is replaced with a random token from the bag. As a nice reminder the XML button takes on the Frost color and icon with the text "Cancel". > buttonValue = "Cancel" > buttonIcon = "token-frost" > buttonColor = "#404450E6" > buttonFontSize = 300 > VALID_TOKENS = { > ["Frost"] = true > } > > require... ----------------------------------------------------------]] -- intentionally global hasXML = true isHelperEnabled = false function updateSave() self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled }) end function onLoad(savedData) if savedData and savedData ~= "" then local loadedData = JSON.decode(savedData) isHelperEnabled = loadedData.isHelperEnabled end createHelperXML() syncDisplayWithOptionPanel() end function createHelperXML() local xmlTable = { { tag = "Button", attributes = { active = "false", id = "Helper", height = buttonHeight or 450, width = buttonWidth or 1400, rotation = buttonRotation or "0 0 180", scale = "0.1 0.1 1", position = buttonPosition or "0 -55 -22", padding = "50 50 50 50", font = "font_teutonic-arkham", fontSize = buttonFontSize or 250, onClick = "triggerXMLTokenLabelCreation", color = buttonColor or "#77674DE6", textColor = "White" }, value = buttonLabel or "Redraw Token" } } if buttonIcon then xmlTable[1].attributes.iconWidth = "400" xmlTable[1].attributes.iconAlignment = "Right" xmlTable[1].attributes.icon = buttonIcon end self.UI.setXmlTable(xmlTable) end function triggerXMLTokenLabelCreation() Global.call("activeRedrawEffect", { VALID_TOKENS = VALID_TOKENS, INVALID_TOKENS = INVALID_TOKENS, RETURN_TO_POOL = RETURN_TO_POOL }) end end) __bundle_register("playercards/CardsWithHelper", function(require, _LOADED, __bundle_register, __bundle_modules) --[[ Library for cards that have helpers This file is used to share code between cards with helpers. It syncs the visibility of the helper with the option panel and makes sure the card has the respective tag. Additionally, it will call 'initiliaze()' and 'shutOff()' in the parent file if they are present. Instructions: 1) Define the global variables before requiring this file: hasXML = true (whether the card has an XML display) isHelperEnabled = false (default state of the helper, should be 'false') 2) In 'onLoad()'', call 'syncDisplayWithOptionPanel()' ----------------------------------------------------------]] local optionPanelApi = require("core/OptionPanelApi") -- if the respective option is enabled in onLoad(), enable the helper function syncDisplayWithOptionPanel() self.addTag("CardWithHelper") local options = optionPanelApi.getOptions() if options.enableCardHelpers then setHelperState(true) else updateDisplay() end end -- forces a new state function setHelperState(newState) isHelperEnabled = newState updateSave() updateDisplay() end -- toggles the current state function toggleHelper() isHelperEnabled = not isHelperEnabled updateSave() updateDisplay() end -- updates the visibility and calls events (after a small delay to allow XML being set) function updateDisplay() Wait.frames(actualDisplayUpdate, 5) end function actualDisplayUpdate() if isHelperEnabled then self.clearContextMenu() self.addContextMenuItem("Disable Helper", toggleHelper) if hasXML then self.UI.show("Helper") end if initialize then initialize() end else self.clearContextMenu() self.addContextMenuItem("Enable Helper", toggleHelper) if hasXML then self.UI.hide("Helper") end if shutOff then shutOff() end end end end) return __bundle_require("__root")