2023-01-29 19:31:52 -05:00
|
|
|
-- 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/token/TokenSpawnTracker", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
|
|
local spawnedCardGuids = { }
|
|
|
|
|
|
|
|
local HAND_ZONES = { }
|
|
|
|
HAND_ZONES["a70eee"] = true -- White
|
|
|
|
HAND_ZONES["0285cc"] = true -- Green
|
|
|
|
HAND_ZONES["5fe087"] = true -- Orange
|
|
|
|
HAND_ZONES["be2f17"] = true -- Red
|
|
|
|
|
|
|
|
function onLoad(saveState)
|
|
|
|
if saveState ~= nil then
|
|
|
|
local saveTable = JSON.decode(saveState) or { }
|
|
|
|
spawnedCardGuids = saveTable.cards or { }
|
|
|
|
end
|
|
|
|
|
|
|
|
createResetMenuItems()
|
|
|
|
end
|
|
|
|
|
|
|
|
function onSave()
|
|
|
|
return JSON.encode({
|
|
|
|
cards = spawnedCardGuids
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
function createResetMenuItems()
|
|
|
|
self.addContextMenuItem("Reset All", resetAll)
|
|
|
|
self.addContextMenuItem("Reset Locations", resetAllLocations)
|
|
|
|
self.addContextMenuItem("Reset Player Cards", resetAllAssetAndEvents)
|
|
|
|
end
|
|
|
|
|
|
|
|
function hasSpawnedTokens(cardGuid)
|
|
|
|
return spawnedCardGuids[cardGuid] == true
|
|
|
|
end
|
|
|
|
|
|
|
|
function markTokensSpawned(cardGuid)
|
|
|
|
spawnedCardGuids[cardGuid] = true
|
|
|
|
end
|
|
|
|
|
|
|
|
function resetTokensSpawned(cardGuid)
|
|
|
|
spawnedCardGuids[cardGuid] = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
function resetAllAssetAndEvents()
|
|
|
|
local resetList = { }
|
|
|
|
for cardGuid, _ in pairs(spawnedCardGuids) do
|
|
|
|
local card = getObjectFromGUID(cardGuid)
|
|
|
|
if card ~= nil then
|
|
|
|
local cardMetadata = JSON.decode(card.getGMNotes()) or { }
|
|
|
|
-- Check this by type rather than the PlayerCard tag so we don't reset weaknesses
|
|
|
|
if cardMetadata.type == "Asset" or cardMetadata.type == "Event" then
|
|
|
|
resetList[cardGuid] = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for cardGuid, _ in pairs(resetList) do
|
|
|
|
spawnedCardGuids[cardGuid] = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function resetAllLocations()
|
|
|
|
local resetList = { }
|
|
|
|
for cardGuid, _ in pairs(spawnedCardGuids) do
|
|
|
|
local card = getObjectFromGUID(cardGuid)
|
|
|
|
if card ~= nil then
|
|
|
|
local cardMetadata = JSON.decode(card.getGMNotes()) or { }
|
|
|
|
-- Check this by type rather than the PlayerCard tag so we don't reset weaknesses
|
|
|
|
if cardMetadata.type == "Location" then
|
|
|
|
resetList[cardGuid] = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for cardGuid, _ in pairs(resetList) do
|
|
|
|
spawnedCardGuids[cardGuid] = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function resetAll()
|
|
|
|
spawnedCardGuids = { }
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Listener to reset card token spawns when they enter a hand.
|
|
|
|
function onObjectEnterZone(zone, enterObject)
|
|
|
|
if HAND_ZONES[zone.getGUID()] then
|
|
|
|
resetTokensSpawned(enterObject.getGUID())
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
2023-08-27 21:09:46 -04:00
|
|
|
__bundle_register("__root", function(require, _LOADED, __bundle_register, __bundle_modules)
|
|
|
|
require("core/token/TokenSpawnTracker")
|
|
|
|
end)
|
2023-01-29 19:31:52 -05:00
|
|
|
return __bundle_require("__root")
|