updated sheet handling
This commit is contained in:
parent
7627643221
commit
c96b96bbb8
@ -11,10 +11,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"1": {
|
"1": {
|
||||||
"body": "The server host can enable or disable cards in hands being hidden from other players by going to the menu at the top of the TTS screen, clicking options, and choosing Hands. The \"Disable\" setting reveals all player hands to all players, while the \"Default\" setting means that each player can only see the cards in their own hand.",
|
"body": "You can instruct the mod to import custom cards with your ArkhamDB deck by putting 'instructions' in the deck description.\nThere's a tool to generate them left of the deck importer. Simply place your cards on it and press 'Generate!'. Then make sure to copy the generated section from the Notebook beginning with '++SCED import instructions++' to your ArkhamDB / arkham.build deck description.\nAfter doing so, the Deck Importer will be able to spawn these cards IF they are added to the mod's card index (for example by throwing them into the 'Additional Cards Box' next to the Player Cards Panel in the upper left corner of the table.\nIt also supports '- remove:' instructions to automatically remove placeholder cards.\nIf you are using a custom investigator, make sure to use a 'remove' instruction to remove the original one.",
|
||||||
"color": "Grey",
|
"color": "Grey",
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"title": "How to Hide Hands",
|
"title": "FAQ: Use custom cards with ArkhamDB",
|
||||||
"visibleColor": {
|
"visibleColor": {
|
||||||
"b": 0.5,
|
"b": 0.5,
|
||||||
"g": 0.5,
|
"g": 0.5,
|
||||||
|
@ -3,14 +3,14 @@ local searchLib = require("util/SearchLib")
|
|||||||
|
|
||||||
local idList = {}
|
local idList = {}
|
||||||
|
|
||||||
local cardWidth = 250
|
local cardWidth = 235
|
||||||
local cardHeight = cardWidth * 1.4
|
local cardHeight = cardWidth * 1.4
|
||||||
local galleryTemplateStart = [[<style>
|
local galleryTemplateStart = [[<style>
|
||||||
.sced-spacer { height: 60px; }
|
.sced-spacer { height: 60px; }
|
||||||
.sced-card { width: 250px; border-radius: 5px; margin: 0; transition: transform 0.25s ease-in-out; }
|
.sced-card { width: ]] .. cardWidth .. [[px; border-radius: 5px; margin: 0; transition: transform 0.25s ease-in-out; }
|
||||||
.sced-slice { background-repeat: no-repeat; }
|
.sced-slice { background-repeat: no-repeat; height: ]] .. cardHeight .. [[px; }
|
||||||
.sced-card:hover { transform: scale(1.45); }
|
.sced-card:hover { transform: scale(1.45); }
|
||||||
.sced-card-container {
|
.sced-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -20,13 +20,14 @@ local galleryTemplateStart = [[<style>
|
|||||||
}
|
}
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
.sced-spacer { height: 0px; }
|
.sced-spacer { height: 0px; }
|
||||||
.sced-card { width: 100%; height: auto; }
|
.sced-card { width: 100%; }
|
||||||
.sced-card:hover { transform: none; }
|
.sced-card:hover { transform: none; }
|
||||||
|
.sced-slice { height: 140%; }
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="sced-container">]]
|
<div class="sced-container">]]
|
||||||
local templateCardRegular = [[ <img class="sced-card sced-regular" src="{{IMAGE_URL}}"/>]]
|
local templateCard = [[ <img class="sced-card" src="{{IMAGE_URL}}"/>]]
|
||||||
local templateCardSlice = [[ <div class="sced-card sced-card-slice" style="background-image: url('{{IMAGE_URL}}'); background-size: {{SHEET_SIZE_1}}px {{SHEET_SIZE_2}}px; background-position: {{OFFSET_1}}px {{OFFSET_2}}px;"></div>]]
|
local templateSlice = [[ <div class="sced-card sced-slice" style="background-image: url('{{IMAGE_URL}}'); background-size: {{SHEET_SIZE_1}}px {{SHEET_SIZE_2}}px; background-position: -{{OFFSET_1}}px -{{OFFSET_2}}px;"></div>]]
|
||||||
local galleryTemplateEnd = [[</div>]] .. "\n" .. [[<div class="sced-spacer"></div>]]
|
local galleryTemplateEnd = [[</div>]] .. "\n" .. [[<div class="sced-spacer"></div>]]
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
@ -36,7 +37,7 @@ function onLoad()
|
|||||||
buttonParameters.width = 800
|
buttonParameters.width = 800
|
||||||
buttonParameters.click_function = "generate"
|
buttonParameters.click_function = "generate"
|
||||||
buttonParameters.color = { 0, 0, 0, 0 }
|
buttonParameters.color = { 0, 0, 0, 0 }
|
||||||
buttonParameters.position = { 0, 0.11, 0.74 }
|
buttonParameters.position = Vector(0, 0.11, 0.74)
|
||||||
buttonParameters.scale = { 0.5, 1, 0.5 }
|
buttonParameters.scale = { 0.5, 1, 0.5 }
|
||||||
self.createButton(buttonParameters)
|
self.createButton(buttonParameters)
|
||||||
end
|
end
|
||||||
@ -124,7 +125,7 @@ function generate(_, playerColor)
|
|||||||
-- edit the existing tab
|
-- edit the existing tab
|
||||||
Notes.editNotebookTab({
|
Notes.editNotebookTab({
|
||||||
index = nb.index,
|
index = nb.index,
|
||||||
body = nb.body .. "\n\n" .. timestamp .. "\n" .. description,
|
body = timestamp .. "\n\n" .. description,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -133,12 +134,7 @@ function generate(_, playerColor)
|
|||||||
-- add a new notebook tab for it (since there was no existing tab)
|
-- add a new notebook tab for it (since there was no existing tab)
|
||||||
Notes.addNotebookTab({
|
Notes.addNotebookTab({
|
||||||
title = "Deck Instructions",
|
title = "Deck Instructions",
|
||||||
body =
|
body = timestamp .. "\n\n" .. description
|
||||||
"Make sure to copy the section beginning with '++SCED import instructions++' to your ArkhamDB / arkham.build deck description." ..
|
|
||||||
"\nAfter doing so, the Deck Importer will be able to spawn these cards IF they are added to the mod's card index (for example by " ..
|
|
||||||
"throwing them into the 'Additional Cards Box' next to the Player Cards Panel in the upper left corner of the table." ..
|
|
||||||
"\nIt also supports '- remove:' instructions to automatically remove placeholder cards.\nIf you are using a custom " ..
|
|
||||||
"investigator, make sure to use a 'remove' instruction to remove the original one.\n\n" .. timestamp .. "\n" .. description
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -154,34 +150,33 @@ end
|
|||||||
function maybeAddImageToGallery(t, data)
|
function maybeAddImageToGallery(t, data)
|
||||||
if data.sheetH and data.sheetW then
|
if data.sheetH and data.sheetW then
|
||||||
-- add cards from decksheets
|
-- add cards from decksheets
|
||||||
local element = templateCardSlice
|
local element = templateSlice
|
||||||
element = element:gsub("{{SHEET_SIZE_1}}", data.sheetW * cardWidth):gsub("{{SHEET_SIZE_2}}", data.sheetH * cardHeight)
|
element = element:gsub("{{SHEET_SIZE_1}}", data.sheetW * cardWidth)
|
||||||
element = element:gsub("{{OFFSET_1}}", data.col * cardWidth):gsub("{{OFFSET_2}}", data.row * cardHeight)
|
element = element:gsub("{{SHEET_SIZE_2}}", data.sheetH * cardHeight)
|
||||||
|
element = element:gsub("{{OFFSET_1}}", (data.col - 1) * cardWidth)
|
||||||
maybeAddCardSlice(t, element, data.face, data.cardId)
|
element = element:gsub("{{OFFSET_2}}", (data.row - 1) * cardHeight)
|
||||||
|
maybeAddSlice(t, element, data.face, data.cardId)
|
||||||
|
|
||||||
if data.uniqueBack then
|
if data.uniqueBack then
|
||||||
maybeAddCardSlice(t, element, data.back, data.cardId)
|
maybeAddSlice(t, element, data.back, data.cardId)
|
||||||
else
|
else
|
||||||
maybeAddCardRegular(t, data.back)
|
maybeAddCard(t, data.back)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- add regular cards
|
-- add regular cards
|
||||||
maybeAddCardRegular(t, data.face)
|
maybeAddCard(t, data.face)
|
||||||
maybeAddCardRegular(t, data.back)
|
maybeAddCard(t, data.back)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function maybeAddCardRegular(t, url)
|
function maybeAddCard(t, url)
|
||||||
if not url then return end
|
if url and not addedImages[url] then
|
||||||
|
|
||||||
if not addedImages[url] then
|
|
||||||
addedImages[url] = true
|
addedImages[url] = true
|
||||||
table.insert(t, templateCardRegular:gsub("{{IMAGE_URL}}", url) .. "\n")
|
table.insert(t, templateCard:gsub("{{IMAGE_URL}}", url) .. "\n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function maybeAddCardSlice(t, element, url, cardId)
|
function maybeAddSlice(t, element, url, cardId)
|
||||||
if not url then return end
|
if not url then return end
|
||||||
|
|
||||||
-- initialize table
|
-- initialize table
|
||||||
@ -237,7 +232,7 @@ function sortByMetadata(a, b)
|
|||||||
|
|
||||||
if isInvestigatorA and not isInvestigatorB then
|
if isInvestigatorA and not isInvestigatorB then
|
||||||
return true
|
return true
|
||||||
elseif isInvestigatorB and not isInvestigatorA then
|
elseif not isInvestigatorA and isInvestigatorB then
|
||||||
return false
|
return false
|
||||||
elseif numA and numB then
|
elseif numA and numB then
|
||||||
return numA < numB
|
return numA < numB
|
||||||
|
Loading…
Reference in New Issue
Block a user