Revert "use require, optimize"

This reverts commit 97b3dd4ce5d876aa5af0344ee409f8e828bbba76.
This commit is contained in:
Chr1Z93 2022-12-06 11:16:00 +01:00
parent b03aee593d
commit 33a33ebbe1
17 changed files with 2738 additions and 297 deletions

View File

@ -1,21 +1,181 @@
-- Customizable Cards: Alchemical Distillation
boxSize = 40
x_1 = -0.933
x_offset = 0.075
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 40
-- static values
x_1 = -0.933
x_offset = 0.075
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.892,
-0.665,
-0.430,
-0.092,
0.142,
0.376,
0.815
-0.892,
-0.665,
-0.430,
-0.092,
0.142,
0.376,
0.815
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 1, 1, 2, 4, 5 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,20 +1,179 @@
-- Customizable Cards: Custom Modifications
boxSize = 38
x_1 = -0.935
x_offset = 0.0735
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 38
-- static values
x_1 = -0.935
x_offset = 0.0735
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.895,
-0.455,
-0.215,
0.115,
0.453,
0.794
-0.895,
-0.455,
-0.215,
0.115,
0.453,
0.794
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 2, 2, 3, 3, 4 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,20 +1,179 @@
-- Customizable Cards: Damning Testimony
boxSize = 40
x_1 = -0.935
x_offset = 0.075
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 40
-- static values
x_1 = -0.935
x_offset = 0.075
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.925,
-0.475,
-0.25,
-0.01,
0.428,
0.772
-0.925,
-0.475,
-0.25,
-0.01,
0.428,
0.772
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 2, 2, 3, 3, 4 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,22 +1,181 @@
-- Customizable Cards: Empirical Hypothesis
boxSize = 37
x_1 = -0.935
x_offset = 0.069
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 37
-- static values
x_1 = -0.935
x_offset = 0.069
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.905,
-0.7,
-0.505,
-0.3,
-0.09,
0.3,
0.592,
0.888
-0.905,
-0.7,
-0.505,
-0.3,
-0.09,
0.3,
0.592,
0.888
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 1, 1, 2, 2, 3, 4 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,24 +1,183 @@
-- Customizable Cards: Friends in Low Places
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons and input boxes
boxSize = 36
inputFontsize = 50
x_1 = -0.935
x_offset = 0.0685
-- static values
x_1 = -0.935
x_offset = 0.0685
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.725,
-0.44,
-0.05,
0.25,
0.545,
0.75,
0.95
-0.725,
-0.44,
-0.05,
0.25,
0.545,
0.75,
0.95
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 2, 2, 2, 2, 3, 3 }
inputBoxes = { 1, 1 }
inputWidth = { 640, 290 }
inputPos = { { 0.275, 0.25, -0.91 }, { 0.6295, 0.25, -0.44 } }
require("playercards/customizable/Upgradesheet")
inputBoxes = { 1, 1 }
inputWidth = { 640, 290 }
inputPos = { { 0.275, 0.25, -0.91 }, { 0.6295, 0.25, -0.44 } }
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,22 +1,181 @@
-- Customizable Cards: Grizzled
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons and input boxes
boxSize = 40
inputFontsize = 50
x_1 = -0.933
x_offset = 0.075
-- static values
x_1 = -0.933
x_offset = 0.075
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.71,
-0.458,
-0.205,
0.362,
0.82
-0.71,
-0.458,
-0.205,
0.362,
0.82
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 2, 3, 4, 5 }
inputBoxes = { 1, 1, 1 }
inputWidth = { 600, 875, 875 }
inputPos = { { 0.3, 0.25, -0.91 }, { 0.005, 0.25, -0.58 }, { 0.005, 0.25, -0.32 } }
require("playercards/customizable/Upgradesheet")
inputBoxes = { 1, 1, 1 }
inputWidth = { 600, 875, 875 }
inputPos = { { 0.3, 0.25, -0.91 }, { 0.005, 0.25, -0.58 }, { 0.005, 0.25, -0.32 } }
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,22 +1,181 @@
-- Customizable Cards: Honed Instinct
boxSize = 38
x_1 = -0.935
x_offset = 0.069
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 38
-- static values
x_1 = -0.935
x_offset = 0.069
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.905,
-0.705,
-0.5,
-0.29,
-0.09,
0.12,
0.325,
0.62
-0.905,
-0.705,
-0.5,
-0.29,
-0.09,
0.12,
0.325,
0.62
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 1, 1, 1, 2, 3, 5 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,21 +1,180 @@
-- Customizable Cards: Hunter's Armor
boxSize = 40
x_1 = -0.933
x_offset = 0.075
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 40
-- static values
x_1 = -0.933
x_offset = 0.075
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.892,
-0.560,
-0.220,
-0.092,
0.047,
0.376,
0.820
-0.892,
-0.560,
-0.220,
-0.092,
0.047,
0.376,
0.820
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 2, 2, 2, 2, 3, 3 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,21 +1,180 @@
-- Customizable Cards: Hyperphysical Shotcaster
boxSize = 38
x_1 = -0.935
x_offset = 0.069
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 38
-- static values
x_1 = -0.935
x_offset = 0.069
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.9,
-0.615,
-0.237,
0.232,
0.61,
0.988,
1.185
-0.9,
-0.615,
-0.237,
0.232,
0.61,
0.988,
1.185
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 2, 2, 2, 2, 2, 4, 4 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -0,0 +1,180 @@
-- Customizable Cards: Living Ink
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 40
-- static values
x_1 = -0.935
x_offset = 0.075
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.69,
-0.355,
0.0855,
0.425,
0.555,
0.685,
1.02
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 2, 2, 3, 3, 3 }
inputBoxes = {}
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,21 +1,180 @@
-- Customizable Cards: Makeshift Trap
boxSize = 39
x_1 = -0.935
x_offset = 0.0735
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 39
-- static values
x_1 = -0.935
x_offset = 0.0735
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.889,
-0.655,
-0.325,
-0.085,
0.252,
0.585,
0.927
-0.889,
-0.655,
-0.325,
-0.085,
0.252,
0.585,
0.927
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 2, 2, 2, 3, 4 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,21 +1,180 @@
-- Customizable Cards: Pocket Multi Tool
boxSize = 40
x_1 = -0.933
x_offset = 0.075
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 40
-- static values
x_1 = -0.933
x_offset = 0.075
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.892,
-0.560,
-0.326,
-0.092,
0.142,
0.376,
0.610
-0.892,
-0.560,
-0.326,
-0.092,
0.142,
0.376,
0.610
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 2, 2, 2, 3, 4 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,22 +1,181 @@
-- Customizable Cards: Power Word
boxSize = 38
x_1 = -0.933
x_offset = 0.069
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 38
-- static values
x_1 = -0.933
x_offset = 0.069
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.905,
-0.6,
-0.32,
-0.02,
0.28,
0.48,
0.775,
0.975
-0.905,
-0.6,
-0.32,
-0.02,
0.28,
0.48,
0.775,
0.975
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 1, 1, 2, 3, 3, 3 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,22 +1,181 @@
-- Customizable Cards: Runic Axe
boxSize = 38
x_1 = -0.935
x_offset = 0.0705
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 38
-- static values
x_1 = -0.935
x_offset = 0.0705
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.92,
-0.715,
-0.415,
-0.018,
0.265,
0.66,
0.86,
1.065
-0.92,
-0.715,
-0.415,
-0.018,
0.265,
0.66,
0.86,
1.065
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 1, 1, 1, 3, 3, 4 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,22 +1,181 @@
-- Customizable Cards: Summoned Servitor
boxSize = 35
x_1 = -0.935
x_offset = 0.068
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons
boxSize = 35
-- static values
x_1 = -0.935
x_offset = 0.068
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.92,
-0.625,
-0.33,
0.055,
0.26,
0.56,
0.765,
1.06
-0.92,
-0.625,
-0.33,
0.055,
0.26,
0.56,
0.765,
1.06
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 1, 1, 1, 2, 3, 5 }
inputBoxes = {}
require("playercards/customizable/Upgradesheet")
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,24 +1,183 @@
-- Customizable Cards: The Raven Quill
-- by Chr1Z
information = {
version = "1.7",
last_updated = "12.10.2022"
}
-- Color information for buttons and input boxes
boxSize = 37
inputFontsize = 38
x_1 = -0.935
x_offset = 0.0705
-- static values
x_1 = -0.935
x_offset = 0.0705
y_visible = 0.25
y_invisible = -0.5
-- z-values (lines on the sheet)
posZ = {
-0.72,
-0.52,
-0.305,
-0.105,
0.1,
0.4,
0.695
-0.72,
-0.52,
-0.305,
-0.105,
0.1,
0.4,
0.695
}
-- box setup (amount of boxes per line and amount of marked boxes in that line)
existingBoxes = { 1, 1, 2, 2, 2, 3, 4 }
inputBoxes = { 1, 1 }
inputWidth = { 425, 775 }
inputPos = { { 0.5, 0.25, -0.905 }, { 0.125, 0.25, 0 } }
require("playercards/customizable/Upgradesheet")
inputBoxes = { 1, 1 }
inputWidth = { 425, 775 }
inputPos = { { 0.5, 0.25, -0.905 }, { 0.125, 0.25, 0 } }
-- override 'marked boxes' for debugging ('all' or 'none')
markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) 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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
function updateState(markedBoxesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data
function makeData()
Data = {}
Data.checkbox = {}
Data.textbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].pos = {}
Data.checkbox[totalCount].pos.x = x_1 + j * x_offset
Data.checkbox[totalCount].pos.z = posZ[i]
Data.checkbox[totalCount].row = i
if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then
Data.checkbox[totalCount].pos.y = y_visible
Data.checkbox[totalCount].state = true
else
Data.checkbox[totalCount].pos.y = y_invisible
Data.checkbox[totalCount].state = false
end
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each textbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.textbox[totalCount] = {}
Data.textbox[totalCount].pos = inputPos[totalCount]
Data.textbox[totalCount].width = inputWidth[totalCount]
Data.textbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function click_checkbox(tableIndex)
local row = Data.checkbox[tableIndex].row
if Data.checkbox[tableIndex].state == true then
Data.checkbox[tableIndex].pos.y = y_invisible
Data.checkbox[tableIndex].state = false
markedBoxes[row] = markedBoxes[row] - 1
else
Data.checkbox[tableIndex].pos.y = y_visible
Data.checkbox[tableIndex].state = true
markedBoxes[row] = markedBoxes[row] + 1
end
self.editButton({
index = tableIndex - 1,
position = Data.checkbox[tableIndex].pos
})
end
-- updates saved value for given text box
function click_textbox(i, value, selected)
if selected == false then
inputValues[i] = value
end
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
local func = function() click_checkbox(i) end
self.setVar(funcName, func)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
scale = { 1, 1, 1 },
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
for i, box_data in ipairs(Data.textbox) do
local funcName = "textbox" .. i
local func = function(_, _, val, sel) click_textbox(i, val, sel) end
self.setVar(funcName, func)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
scale = buttonScale,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
font_color = buttonFontColor,
value = box_data.value
})
end
end

View File

@ -1,125 +0,0 @@
-- override 'marked boxes' for debugging ('all' or 'none')
local markDEBUG = ""
-- save state when going into bags / decks
function onDestroy() self.script_state = onSave() end
function onSave() return JSON.encode({ markedBoxes, inputValues }) end
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]
else
markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
inputValues = { "", "", "", "", "" }
end
makeData()
createButtonsAndBoxes()
self.addContextMenuItem("Reset Inputs", function() updateState() end)
self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end)
self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end)
self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end)
end
-- can be called to set the state to 'markedBoxesNew' / 'inputValuesNew'
function updateState(markedBoxesNew, inputValuesNew)
if markedBoxesNew then markedBoxes = markedBoxesNew end
if inputValuesNew then inputValues = inputValuesNew end
makeData()
createButtonsAndBoxes()
end
-- create Data (mainly positions of boxes)
function makeData()
Data = {}
Data.checkbox = {}
Data.inputbox = {}
-- repeat this for each entry (= line) in existingBoxes
local totalCount = 0
for i = 1, #existingBoxes do
-- repeat this for each checkbox per line
for j = 1, existingBoxes[i] do
local state = (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none")
totalCount = totalCount + 1
Data.checkbox[totalCount] = {}
Data.checkbox[totalCount].state = state
Data.checkbox[totalCount].pos = { x = x_1 + j * x_offset, y = state and 0.25 or -0.5, z = posZ[i] }
Data.checkbox[totalCount].row = i
end
end
-- repeat this for each entry (= line) in inputBoxes
local totalCount = 0
for i = 1, #inputBoxes do
-- repeat this for each inputbox per line
for j = 1, inputBoxes[i] do
totalCount = totalCount + 1
Data.inputbox[totalCount] = {}
Data.inputbox[totalCount].pos = inputPos[totalCount]
Data.inputbox[totalCount].width = inputWidth[totalCount]
Data.inputbox[totalCount].value = inputValues[totalCount]
end
end
end
-- checks or unchecks the given box
function clickCheckbox(tableIndex)
local row = Data.checkbox[tableIndex].row
local state = Data.checkbox[tableIndex].state
Data.checkbox[tableIndex].state = not state
Data.checkbox[tableIndex].pos.y = state and -0.5 or 0.25
markedBoxes[row] = markedBoxes[row] + (state and -1 or 1)
self.editButton({ index = tableIndex - 1, position = Data.checkbox[tableIndex].pos })
end
-- updates saved value for given text box
function clickTextbox(i, value, selected)
if selected then return end
inputValues[i] = value
end
function createButtonsAndBoxes()
self.clearButtons()
self.clearInputs()
-- create checkboxes
for i, box_data in ipairs(Data.checkbox) do
local funcName = "checkbox" .. i
self.setVar(funcName, function() clickCheckbox(i) end)
self.createButton({
click_function = funcName,
function_owner = self,
position = box_data.pos,
height = boxSize,
width = boxSize,
font_size = box_data.size,
color = { 0, 0, 0 },
font_color = { 0, 0, 0 }
})
end
-- create inputboxes
for i, box_data in ipairs(Data.inputbox) do
local funcName = "inputbox" .. i
self.setVar(funcName, function(_, _, val, sel) clickTextbox(i, val, sel) end)
self.createInput({
input_function = funcName,
function_owner = self,
label = "Click to type",
alignment = 2,
position = box_data.pos,
width = box_data.width,
height = (inputFontsize * 1) + 24,
font_size = inputFontsize,
color = "White",
value = box_data.value
})
end
end