Merge pull request #382 from argonui/top-of-file-cleanup

Script file cleanup
This commit is contained in:
Chr1Z 2023-09-26 17:58:56 +02:00 committed by GitHub
commit 8be0a0e8fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 80 additions and 91 deletions

View File

@ -1,3 +1,9 @@
local blessCurseApi = require("chaosbag/BlessCurseManagerApi")
local chaosBagApi = require("chaosbag/ChaosBagApi")
local deckImporterApi = require("arkhamdb/DeckImporterApi")
local optionPanelApi = require("core/OptionPanelApi")
local playAreaApi = require("core/PlayAreaApi")
local campaignTokenData = {
GUID = "51b1c9",
Name = "Custom_Model",
@ -46,14 +52,7 @@ local DAMAGE_HORROR_GUIDS = {
"468e88"; "0257d9"; "7b5729"; "beb964";
}
local chaosBagApi = require("chaosbag/ChaosBagApi")
local playAreaApi = require("core/PlayAreaApi")
local deckImporterApi = require("arkhamdb/DeckImporterApi")
local optionPanelApi = require("core/OptionPanelApi")
local blessCurseApi = require("chaosbag/BlessCurseManagerApi")
local TOUR_GUID = "0e5aa8"
local campaignBoxGUID
function onLoad(save_state)

View File

@ -1,3 +1,5 @@
local chaosBagApi = require("chaosbag/ChaosBagApi")
local TOKEN_IDS = {
-- first row
"p1", "0", "m1", "m2", "m3", "m4",
@ -34,7 +36,6 @@ buttonParameters.height = 300
local name
local tokens = {}
local chaosBagApi = require("chaosbag/ChaosBagApi")
function onLoad()
-- create buttons for tokens

View File

@ -2,12 +2,13 @@
- sets counters to default values (resources and doom) or trauma values (health and sanity, if not disabled) from campaign log
- puts everything on playmats and hands into respective trashcans
- use the IGNORE_TAG to exclude objects from tidying (default: "CleanUpHelper_Ignore")]]
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local soundCubeApi = require("core/SoundCubeApi")
local playmatApi = require("playermat/PlaymatApi")
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local chaosBagApi = require("chaosbag/ChaosBagApi")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local soundCubeApi = require("core/SoundCubeApi")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
-- these objects will be ignored
local IGNORE_GUIDS = {

View File

@ -1,5 +1,5 @@
local mythosAreaApi = require("core/MythosAreaApi")
local chaosBagApi = require("chaosbag/ChaosBagApi")
local mythosAreaApi = require("core/MythosAreaApi")
-- common parameters
local buttonParameters = {}

View File

@ -1,6 +1,7 @@
do
local playAreaApi = require("core/PlayAreaApi")
local allCardsBagApi = require("playercards/AllCardsBagApi")
local playAreaApi = require("core/PlayAreaApi")
local ArkhamDb = { }
local internal = { }

View File

@ -2,7 +2,6 @@ do
local DeckImporterApi = {}
local DECK_IMPORTER_GUID = "a28140"
-- Returns a table with the full state of the UI, including options and deck IDs.
-- This can be used to persist via onSave(), or provide values for a load operation
-- Table values:
@ -22,7 +21,7 @@ do
end
-- Updates the state of the UI based on the provided table. Any values not provided will be left the same.
-- @param uiStateTable Table of values to update on importer
---@param uiStateTable Table of values to update on importer
-- Table values:
-- redDeck: Deck ID to load for the red player
-- orangeDeck: Deck ID to load for the orange player

View File

@ -1,10 +1,10 @@
require("arkhamdb/DeckImporterUi")
require("playercards/PlayerCardSpawner")
local playmatApi = require("playermat/PlaymatApi")
local playAreaApi = require("core/PlayAreaApi")
local allCardsBagApi = require("playercards/AllCardsBagApi")
local arkhamDb = require("arkhamdb/ArkhamDb")
local playAreaApi = require("core/PlayAreaApi")
local playmatApi = require("playermat/PlaymatApi")
local zones = require("playermat/Zones")
function onLoad(script_state)

View File

@ -1,3 +1,5 @@
local allCardsBagApi = require("playercards/AllCardsBagApi")
local INPUT_FIELD_HEIGHT = 340
local INPUT_FIELD_WIDTH = 1500
local FIELD_COLOR = { 0.9, 0.7, 0.5 }
@ -23,8 +25,6 @@ local privateDeck = true
local loadNewestDeck = true
local loadInvestigators = false
local allCardsBagApi = require("playercards/AllCardsBagApi")
-- Returns a table with the full state of the UI, including options and deck IDs.
-- This can be used to persist via onSave(), or provide values for a load operation
-- Table values:
@ -48,7 +48,7 @@ function getUiState()
end
-- Updates the state of the UI based on the provided table. Any values not provided will be left the same.
-- @param uiStateTable Table of values to update on importer
---@param uiStateTable Table of values to update on importer
-- Table values:
-- redDeck: Deck ID to load for the red player
-- orangeDeck: Deck ID to load for the orange player

View File

@ -1,3 +1,4 @@
local chaosBagApi = require("chaosbag/ChaosBagApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi")
-- common button parameters
@ -23,8 +24,6 @@ local FONT_COLOR = {
local whitespace = " "
local updating
local chaosBagApi = require("chaosbag/ChaosBagApi")
---------------------------------------------------------
-- creating buttons and menus + initializing tables
---------------------------------------------------------

View File

@ -1,7 +1,7 @@
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local optionPanelApi = require("core/OptionPanelApi")
local playmatApi = require("playermat/PlaymatApi")
local victoryDisplayApi = require("core/VictoryDisplayApi")
local optionPanelApi = require("core/OptionPanelApi")
function onLoad()
addHotkey("Add Doom to Agenda", addDoomToAgenda)

View File

@ -1,7 +1,7 @@
local playAreaApi = require("core/PlayAreaApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local tokenChecker = require("core/token/TokenChecker")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local ENCOUNTER_DECK_AREA = {
upperLeft = { x = 0.9, z = 0.42 },

View File

@ -1,6 +1,5 @@
do
local PlayAreaApi = { }
local PLAY_AREA_GUID = "721ba2"
local INVESTIGATOR_COUNTER_GUID = "f182ee"

View File

@ -1,6 +1,7 @@
local controlActive = false
local playAreaApi = require("core/PlayAreaApi")
local controlActive = false
-- parameters for open/close button for reusing
local buttonParameters = {}
buttonParameters.function_owner = self

View File

@ -1,6 +1,5 @@
do
local SoundCubeApi = {}
local internal = {}
-- this table links the name of a trigger effect to its index
local soundIndices = {
@ -9,14 +8,14 @@ do
["Dark Souls"] = 2
}
internal.playTriggerEffect = function(index)
local function playTriggerEffect(index)
getObjectsWithTag("SoundCube")[1].AssetBundle.playTriggerEffect(index)
end
-- plays the by name requested sound
---@param soundName String Name of the sound to play
SoundCubeApi.playSoundByName = function(soundName)
internal.playTriggerEffect(soundIndices[soundName])
playTriggerEffect(soundIndices[soundName])
end
return SoundCubeApi

View File

@ -1,14 +1,17 @@
local chaosBagApi = require("chaosbag/ChaosBagApi")
local playAreaApi = require("core/PlayAreaApi")
local tokenChecker = require("core/token/TokenChecker")
local pendingCall = false
local messageSent = {}
local missingData = {}
local countedVP = {}
local highlightMissing = false
local highlightCounted = false
local TRASHCAN
local TRASHCAN_GUID = "70b9f6"
local chaosBagApi = require("chaosbag/ChaosBagApi")
-- button creation when loading the game
function onLoad()

View File

@ -1,7 +1,7 @@
do
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local playAreaApi = require("core/PlayAreaApi")
local optionPanelApi = require("core/OptionPanelApi")
local playAreaApi = require("core/PlayAreaApi")
local tokenSpawnTrackerApi = require("core/token/TokenSpawnTrackerApi")
local PLAYER_CARD_TOKEN_OFFSETS = {
[1] = {

View File

@ -1,6 +1,5 @@
do
local TokenSpawnTracker = { }
local SPAWN_TRACKER_GUID = "e3ffc9"
TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)

View File

@ -1,11 +1,3 @@
-- Search-A-Card
-- made by: Chr1Z
-- description: spawns the card(s) with the specified name
information = {
version = "1.2",
last_updated = "12.11.2022"
}
require("playercards/PlayerCardSpawner")
local allCardsBagApi = require("playercards/AllCardsBagApi")
@ -17,9 +9,11 @@ buttonParameters.width = 1200
buttonParameters.font_size = 75
local BUTTON_LABELS = {}
BUTTON_LABELS["spawn"] = {}
BUTTON_LABELS["spawn"][true] = "Mode: Spawn all matching cards "
BUTTON_LABELS["spawn"][false] = "Mode: Spawn first matching card"
BUTTON_LABELS["search"] = {}
BUTTON_LABELS["search"][true] = "Mode: Name matches search term"
BUTTON_LABELS["search"][false] = "Mode: Name contains search term"
@ -35,13 +29,15 @@ inputParameters.height = 130
inputParameters.font_size = 107
-- main code
function onSave() return JSON.encode({ spawnAll, searchExact, inputParameters.value }) end
function onSave()
return JSON.encode({ spawnAll, searchExact, inputParameters.value })
end
function onLoad(saved_data)
local loaded_data = JSON.decode(saved_data)
spawnAll = loaded_data[1] or false
searchExact = loaded_data[2] or false
inputParameters.value = loaded_data[3] or ""
function onLoad(savedData)
local loadedData = JSON.decode(savedData)
spawnAll = loadedData[1] or false
searchExact = loadedData[2] or false
inputParameters.value = loadedData[3] or ""
-- index 0: button for spawn mode
buttonParameters.click_function = "search"
@ -62,11 +58,6 @@ function onLoad(saved_data)
self.createButton(buttonParameters)
self.createInput(inputParameters)
self.addContextMenuItem("More Information", function()
printToAll("------------------------------", "White")
printToAll("Search-A-Card v" .. information["version"] .. " by Chr1Z", "Orange")
printToAll("last updated: " .. information["last_updated"], "White")
end)
end
function spawnMode()

View File

@ -69,8 +69,9 @@ Thus it should be implemented like this:
----------------------------------------------------------]]
local blessCurseManagerApi = require("chaosbag/BlessCurseManagerApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi")
local chaosBagApi = require("chaosbag/ChaosBagApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi")
local sealedTokens = {}
local ID_URL_MAP = {}
local tokensInBag = {}

View File

@ -1,7 +1,8 @@
require("playercards/PlayerCardPanelData")
local spawnBag = require("playercards/SpawnBag")
local arkhamDb = require("arkhamdb/ArkhamDb")
local allCardsBagApi = require("playercards/AllCardsBagApi")
local arkhamDb = require("arkhamdb/ArkhamDb")
local spawnBag = require("playercards/SpawnBag")
-- Size and position information for the three rows of class buttons
local CIRCLE_BUTTON_SIZE = 250

View File

@ -1,4 +1,3 @@
-- Amount to shift for the next card (zShift) or next row of cards (xShift)
-- Note that the table rotation is weird, and the X axis is vertical while the
-- Z axis is horizontal

View File

@ -23,14 +23,14 @@ require("playercards/PlayerCardSpawner")
-- }
-- See BondedBag.ttslua for an example
do
local allCardsBagApi = require("playercards/AllCardsBagApi")
local SpawnBag = { }
local internal = { }
-- To assist debugging, will draw a box around the recall zone when it's set up
local SHOW_RECALL_ZONE = false
local allCardsBagApi = require("playercards/AllCardsBagApi")
-- Distance to expand the recall zone around any added object.
local RECALL_BUFFER_X = 0.9
local RECALL_BUFFER_Z = 0.5

View File

@ -1,7 +1,3 @@
-- Stat Tracker
-- made by: Chr1Z
-- description: helps tracking the stats of your investigator
local BUTTON_PARAMETERS = {}
BUTTON_PARAMETERS.function_owner = self
BUTTON_PARAMETERS.height = 650