Added ArkhamDB Importer support for SS upgrade sheet changes, and minor refactor on code logic for the same
This commit is contained in:
parent
da2dd66966
commit
ed9d8c2614
@ -34,7 +34,7 @@
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": false,
|
||||
"LuaScript": "require(\"playercards/customizable/SummonedServitorUpgradeSheet\")",
|
||||
"LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"],\"\"]",
|
||||
"LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\"]]",
|
||||
"MeasureMovement": false,
|
||||
"Name": "CardCustom",
|
||||
"Nickname": "Summoned Servitor Upgrade Sheet",
|
||||
|
@ -5,7 +5,7 @@ local playAreaApi = require("core/PlayAreaApi")
|
||||
local arkhamDb = require("arkhamdb/ArkhamDb")
|
||||
local zones = require("playermat/Zones")
|
||||
|
||||
local DEBUG = false
|
||||
local DEBUG = true
|
||||
|
||||
local ALL_CARDS_GUID = "15bb07"
|
||||
|
||||
@ -30,6 +30,11 @@ customizationRowsWithFields["09079"].inputMap = {}
|
||||
customizationRowsWithFields["09079"].inputMap[1] = 1
|
||||
customizationRowsWithFields["09079"].inputMap[5] = 2
|
||||
customizationRowsWithFields["09079"].inputMap[6] = 3
|
||||
-- Summoned Servitor
|
||||
customizationRowsWithFields["09080"] = {}
|
||||
customizationRowsWithFields["09080"].inputCount = 1
|
||||
customizationRowsWithFields["09080"].inputMap = {}
|
||||
customizationRowsWithFields["09080"].inputMap[6] = 1
|
||||
-- Grizzled
|
||||
customizationRowsWithFields["09101"] = {}
|
||||
customizationRowsWithFields["09101"].inputCount = 3
|
||||
@ -372,6 +377,9 @@ function handleCustomizableUpgrades(cardList, customizations)
|
||||
table.insert(inputValues, "")
|
||||
end
|
||||
end
|
||||
for key, value in pairs(inputValues) do
|
||||
log("Key " .. key.." Value " .. value)
|
||||
end
|
||||
local inputCount = 0
|
||||
for _, entry in ipairs(index_xp) do
|
||||
local counter = 0
|
||||
@ -389,15 +397,19 @@ function handleCustomizableUpgrades(cardList, customizations)
|
||||
inputValues[customizationRowsWithFields[baseId].inputMap[index]] = convertRavenQuillSelections(str)
|
||||
elseif customizationRowsWithFields[baseId] ~= nil then
|
||||
inputValues[customizationRowsWithFields[baseId].inputMap[index]] = str
|
||||
log(str)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- remove first entry in markedBoxes if row 0 has textbox
|
||||
if customizationRowsWithFields[baseId] ~= nil
|
||||
and customizationRowsWithFields[baseId].inputCount > 0 then
|
||||
table.remove(markedBoxes, 1)
|
||||
if customizationRowsWithFields[baseId] ~= nil and customizationRowsWithFields[baseId].inputCount > 0 then
|
||||
if (baseId == "09080" and markedBoxes[6] == 2 and inputValues[customizationRowsWithFields[baseId].inputMap[6]] == "") then
|
||||
inputValues[customizationRowsWithFields[baseId].inputMap[6]] = "0"
|
||||
else
|
||||
table.remove(markedBoxes, 1)
|
||||
end
|
||||
end
|
||||
|
||||
-- write the loaded values to the save_data of the sheets
|
||||
|
@ -35,9 +35,12 @@ inputBoxes = {}
|
||||
local SLOT_ICON_POSITIONS = {
|
||||
arcane = { x = 0.160, z = 0.65},
|
||||
ally = { x = -0.073, z = 0.65}
|
||||
}
|
||||
}
|
||||
|
||||
local selectedSlot = ""
|
||||
-- These match with ArkhamDB's way of storing the data in the dropdown menu
|
||||
local slotIndices = {arcane = "1", ally = "0", none = ""}
|
||||
|
||||
local selectedSlot = slotIndices.none
|
||||
|
||||
-- override 'marked boxes' for debugging ('all' or 'none')
|
||||
markDEBUG = ""
|
||||
@ -45,22 +48,17 @@ markDEBUG = ""
|
||||
-- save state when going into bags / decks
|
||||
function onDestroy() self.script_state = onSave() end
|
||||
|
||||
function onSave() return JSON.encode({ markedBoxes, inputValues, selectedSlot }) end
|
||||
function onSave() return JSON.encode({ markedBoxes, {selectedSlot} }) end
|
||||
|
||||
-- Startup procedure
|
||||
function onLoad(saved_data)
|
||||
if saved_data ~= "" and markDEBUG == "" then
|
||||
local loaded_data = JSON.decode(saved_data)
|
||||
markedBoxes = loaded_data[1]
|
||||
inputValues = loaded_data[2]
|
||||
if #loaded_data > 2 then
|
||||
selectedSlot = loaded_data[3]
|
||||
else
|
||||
selectedSlot = ""
|
||||
end
|
||||
selectedSlot = loaded_data[2][1]
|
||||
else
|
||||
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
inputValues = { "", "", "", "", "" }
|
||||
selectedSlot = ""
|
||||
end
|
||||
|
||||
makeData()
|
||||
@ -214,22 +212,22 @@ function makeSlotSelectionButtons()
|
||||
buttonPositions.x = -1 * SLOT_ICON_POSITIONS.ally.x
|
||||
buttonData.position = buttonPositions
|
||||
self.createButton(buttonData)
|
||||
end
|
||||
end
|
||||
|
||||
function click_arcane()
|
||||
if selectedSlot ~= "arcane" then
|
||||
selectedSlot = "arcane"
|
||||
if selectedSlot == slotIndices.arcane then
|
||||
selectedSlot = slotIndices.none
|
||||
else
|
||||
selectedSlot = ""
|
||||
selectedSlot = slotIndices.arcane
|
||||
end
|
||||
updateSlotDisplay()
|
||||
end
|
||||
end
|
||||
|
||||
function click_ally()
|
||||
if selectedSlot ~= "ally" then
|
||||
selectedSlot = "ally"
|
||||
if selectedSlot == slotIndices.ally then
|
||||
selectedSlot = slotIndices.none
|
||||
else
|
||||
selectedSlot = ""
|
||||
selectedSlot = slotIndices.ally
|
||||
end
|
||||
updateSlotDisplay()
|
||||
end
|
||||
@ -256,9 +254,9 @@ function updateSlotDisplay()
|
||||
}
|
||||
local arcaneVecColor = {0.5, 0.5, 0.5, 0.75}
|
||||
local allyVecColor = {0.5, 0.5, 0.5, 0.75}
|
||||
if selectedSlot == "arcane" then
|
||||
if selectedSlot == slotIndices.arcane then
|
||||
arcaneVecColor = {0.597, 0.195, 0.796}
|
||||
elseif selectedSlot == "ally" then
|
||||
elseif selectedSlot == slotIndices.ally then
|
||||
allyVecColor = {0.597, 0.195, 0.796}
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user