Moved deck instruction output to Notebook

This commit is contained in:
Chr1Z93 2024-08-15 18:51:50 +02:00
parent 1ef6c641a1
commit a098d46943
3 changed files with 32 additions and 20 deletions

View File

@ -1,5 +1,5 @@
{
"1": {
"0": {
"body": "Welcome to Arkham Horror LCG - Super Complete Edition!\n\nMake sure to take the tour that can be started with the token in the middle of the main playarea. Some basic notes:\n\nDECKBUILDING\n- All currently existing investigators and player cards are accessible via the player card panel in the upper left corner of the table.\n\n- On the leftside underneath the Investigators, you will find the ArkhamDB Deckimporter. Insert your deck ID and it will build the deck automatically for you.\n\nSCENARIOS \u0026 SETUP\n- Arkham Horror LCG comes with a core campaign (Night of the Zealot) and several expansions. Within each box you will find all the cards required for each scenario setup, as well as a the official campaign guide PDF.\n\n2. Each scenario is setup differently, and while some of the work has been prepared beforehand (such as building encounter decks), you will have to refer to the Campaign Guide for specific instructions on how to set up each scenario.\n\nINVESTIGATOR PLAYMAT AND GAMEPLAY\n- Playermats are scripted to automate most of the gameplay for you.",
"color": "Grey",
"id": 1,
@ -10,7 +10,7 @@
"r": 0.5
}
},
"2": {
"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.",
"color": "Grey",
"id": 2,

View File

@ -31,7 +31,7 @@
"ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2466368617700119071/AB8294EEBA3A219CDCE287323B764D13E2A43822/",
"WidthScale": 0
},
"Description": "This tool can generate a description for your deck on ArkhamDB that will instruct the Deck Importer to add the specified cards.\nThe cards need to be available (either from the AllCardsBag or the 'Additional Playercards Bag'.",
"Description": "This tool can generate a description for your deck on ArkhamDB that will instruct the Deck Importer to add the specified cards.\n\nThe cards need to be available (either from the AllCardsBag or the 'Additional Playercards Bag').",
"DragSelectable": true,
"GMNotes": "",
"GUID": "240522",

View File

@ -13,18 +13,6 @@ function onLoad()
buttonParameters.position = { 0, 0.11, 0.74 }
buttonParameters.scale = { 0.5, 1, 0.5 }
self.createButton(buttonParameters)
-- "output" text field
local inputParameters = {}
inputParameters.label = "Click button above"
inputParameters.input_function = "none"
inputParameters.function_owner = self
inputParameters.position = { 0, 0.11, 1.1 }
inputParameters.width = 1200
inputParameters.height = 130
inputParameters.font_size = 107
inputParameters.scale = { 0.4, 1, 0.4 }
self.createInput(inputParameters)
end
-- generates a string for the deck notes that will instruct the Deck Importer to add the specified cards
@ -44,8 +32,11 @@ function generate(_, playerColor)
broadcastToColor("Didn't find any valid cards.", playerColor, "Red")
return
else
broadcastToColor("Created deck instruction for " .. #idList .. " card(s). Copy it from the input field.", playerColor,
"Green")
local cardString = #idList .. " cards"
if #idList == 1 then
cardString = " 1 card"
end
broadcastToColor("Parsed " .. cardString .. ": Go to Notebook > Deck Instructions", playerColor, "Green")
end
-- sort the idList
@ -57,7 +48,30 @@ function generate(_, playerColor)
description = description .. "\n- add: " .. entry.id .. " (**" .. entry.name .. "**)"
end
self.editInput({ index = 0, value = description })
-- get a timestamp
local timestamp = os.date("%Y-%m-%d %H:%M")
-- get notebook data
for _, nb in ipairs(Notes.getNotebookTabs()) do
if nb.title == "Deck Instructions" then
-- edit the existing tab
Notes.editNotebookTab({
index = nb.index,
body = nb.body .. "\n\n" .. timestamp .. "\n" .. description,
})
return
end
end
-- add a new notebook tab for it (since there was no existing tab)
Notes.addNotebookTab({
title = "Deck Instructions",
body =
"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 mods card index (for example by " ..
"throwing them into the 'Additional Cards Bag'.\nIt also supports '- remove:' instructions to automatically remove placeholder cards.\n\n" ..
timestamp .. "\n" .. description
})
end
-- use the ZoopGuid as fallback if no id present
@ -88,5 +102,3 @@ function sortById(a, b)
return a.name < b.name
end
end
function none() end