missing mat handling

This commit is contained in:
Chr1Z93 2024-11-10 23:59:46 +01:00
parent d533aa1c9b
commit 8a7a003174

View File

@ -4,12 +4,11 @@ atttempt to spawn clues, first we look for <LOCATION_NAME>_<GUID> and if
we find nothing we look for <LOCATION_NAME> we find nothing we look for <LOCATION_NAME>
format is [location_guid -> clueCount] format is [location_guid -> clueCount]
]] ]]
LOCATIONS_DATA_JSON = [[ LOCATIONS_DATA_JSON = [[{
{
"San Francisco": {"type": "fixed", "value": 1, "clueSide": "back"}, "San Francisco": {"type": "fixed", "value": 1, "clueSide": "back"},
" Arkham": {"type": "perPlayer", "value": 1, "clueSide": "back"}, "Arkham": {"type": "perPlayer", "value": 1, "clueSide": "back"},
"Buenos Aires": {"type": "fixed", "value": 2, "clueSide": "back"}, "Buenos Aires": {"type": "fixed", "value": 2, "clueSide": "back"},
" London": {"type": "perPlayer", "value": 2, "clueSide": "front"}, "London": {"type": "perPlayer", "value": 2, "clueSide": "front"},
"Rome": {"type": "perPlayer", "value": 3, "clueSide": "front"}, "Rome": {"type": "perPlayer", "value": 3, "clueSide": "front"},
"Istanbul": {"type": "perPlayer", "value": 4, "clueSide": "front"}, "Istanbul": {"type": "perPlayer", "value": 4, "clueSide": "front"},
"Tokyo_123abc": {"type": "perPlayer", "value": 0, "clueSide": "back"}, "Tokyo_123abc": {"type": "perPlayer", "value": 0, "clueSide": "back"},
@ -17,30 +16,14 @@ LOCATIONS_DATA_JSON = [[
"Tokyo": {"type": "fixed", "value": 2, "clueSide": "back"}, "Tokyo": {"type": "fixed", "value": 2, "clueSide": "back"},
"Shanghai_123": {"type": "fixed", "value": 12, "clueSide": "front"}, "Shanghai_123": {"type": "fixed", "value": 12, "clueSide": "front"},
"Sydney": {"type": "fixed", "value": 0, "clueSide": "front"} "Sydney": {"type": "fixed", "value": 0, "clueSide": "front"}
} }]]
]]
PLAYER_CARD_DATA_JSON = [[{
PLAYER_CARD_DATA_JSON = [[
{
"Tool Belt": {
"tokenType": "resource",
"tokenCount": 2
},
"Tool Belt (3)": {
"tokenType": "resource",
"tokenCount": 4
},
"Yithian Rifle": {
"tokenType": "resource",
"tokenCount": 3
},
"xxx": { "xxx": {
"tokenType": "resource", "tokenType": "resource",
"tokenCount": 3 "tokenCount": 3
} }
} }]]
]]
HIDDEN_CARD_DATA = { HIDDEN_CARD_DATA = {
"Unpleasant Card (Doom)", "Unpleasant Card (Doom)",
@ -54,14 +37,14 @@ PLAYER_CARD_DATA = JSON.decode(PLAYER_CARD_DATA_JSON)
function onload(save_state) function onload(save_state)
local playArea = getObjectFromGUID('721ba2') local playArea = getObjectFromGUID('721ba2')
playArea.call("updateLocations", {self.getGUID()}) playArea.call("updateLocations", {self.getGUID()})
local playerMatWhite = getObjectFromGUID('8b081b')
playerMatWhite.call("updatePlayerCards", {self.getGUID()}) for _, guid in ipairs({ '8b081b', 'bd0ff4', '383d8b', '0840d5'}) do
local playerMatOrange = getObjectFromGUID('bd0ff4') local mat = getObjectFromGUID(guid)
playerMatOrange.call("updatePlayerCards", {self.getGUID()}) if mat ~= nil then
local playerMatGreen = getObjectFromGUID('383d8b') mat.call("updatePlayerCards", {self.getGUID()})
playerMatGreen.call("updatePlayerCards", {self.getGUID()}) end
local playerMatRed = getObjectFromGUID('0840d5') end
playerMatRed.call("updatePlayerCards", {self.getGUID()})
local dataHelper = getObjectFromGUID('708279') local dataHelper = getObjectFromGUID('708279')
dataHelper.call("updateHiddenCards", {self.getGUID()}) dataHelper.call("updateHiddenCards", {self.getGUID()})
end end