Merge branch 'main' into clean-up-helper
This commit is contained in:
commit
aa70467489
@ -89,12 +89,12 @@
|
|||||||
],
|
],
|
||||||
"Tooltip": true,
|
"Tooltip": true,
|
||||||
"Transform": {
|
"Transform": {
|
||||||
"posX": 40.7253036,
|
"posX": 40,
|
||||||
"posY": 1.29860592,
|
"posY": 1.3,
|
||||||
"posZ": 66.7765656,
|
"posZ": 66,
|
||||||
"rotX": 1.697304e-7,
|
"rotX": 0,
|
||||||
"rotY": 270.0102,
|
"rotY": 270,
|
||||||
"rotZ": 2.00479718e-7,
|
"rotZ": 0,
|
||||||
"scaleX": 0.6,
|
"scaleX": 0.6,
|
||||||
"scaleY": 1,
|
"scaleY": 1,
|
||||||
"scaleZ": 0.6
|
"scaleZ": 0.6
|
||||||
|
@ -28,6 +28,9 @@ Spawner.spawnCards = function(cardList, pos, rot, sort, callback)
|
|||||||
if card.metadata.type == "Investigator" then
|
if card.metadata.type == "Investigator" then
|
||||||
table.insert(investigatorCards, card)
|
table.insert(investigatorCards, card)
|
||||||
elseif card.metadata.type == "Minicard" then
|
elseif card.metadata.type == "Minicard" then
|
||||||
|
-- set proper scale for minicards
|
||||||
|
card.data.Transform.scaleX = 0.6
|
||||||
|
card.data.Transform.scaleZ = 0.6
|
||||||
table.insert(miniCards, card)
|
table.insert(miniCards, card)
|
||||||
else
|
else
|
||||||
table.insert(standardCards, card)
|
table.insert(standardCards, card)
|
||||||
|
@ -1,32 +1,31 @@
|
|||||||
-- this script is shared between the lvl 0 and lvl 3 versions of Scroll of Secrets
|
|
||||||
local mythosAreaApi = require("core/MythosAreaApi")
|
local mythosAreaApi = require("core/MythosAreaApi")
|
||||||
local playermatApi = require("playermat/PlayermatApi")
|
local playermatApi = require("playermat/PlayermatApi")
|
||||||
|
|
||||||
-- get class via metadata and create context menu accordingly
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
local notes = JSON.decode(self.getGMNotes())
|
-- get class via metadata and proceed menu accordingly:
|
||||||
if notes then
|
|
||||||
createContextMenu(notes.id)
|
|
||||||
else
|
|
||||||
print("Missing metadata for Scroll of Secrets!")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function createContextMenu(id)
|
|
||||||
if id == "05116" or id == "05116-t" then
|
|
||||||
-- lvl 0: draw 1 card from the bottom
|
-- lvl 0: draw 1 card from the bottom
|
||||||
self.addContextMenuItem("Draw bottom card", function(playerColor) contextFunc(playerColor, 1) end)
|
|
||||||
elseif id == "05188" or id == "05188-t" then
|
|
||||||
-- seeker lvl 3: draw 3 cards from the bottom
|
|
||||||
self.addContextMenuItem("Draw bottom card(s)", function(playerColor) contextFunc(playerColor, 3) end)
|
|
||||||
elseif id == "05189" or id == "05189-t" then
|
|
||||||
-- mystic lvl 3: draw 1 card from the bottom
|
-- mystic lvl 3: draw 1 card from the bottom
|
||||||
self.addContextMenuItem("Draw bottom card", function(playerColor) contextFunc(playerColor, 1) end)
|
local buttonLabel = "Draw bottom card"
|
||||||
|
local amount = 1
|
||||||
|
local notes = JSON.decode(self.getGMNotes())
|
||||||
|
if notes.id == "05188" or notes.id == "05188-t" then
|
||||||
|
-- seeker lvl 3: draw 3 cards from the bottom
|
||||||
|
buttonLabel = buttonLabel .. "(s)"
|
||||||
|
amount = 3
|
||||||
end
|
end
|
||||||
|
self.addContextMenuItem(buttonLabel, function(playerColor) contextFunc(playerColor, amount) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function contextFunc(playerColor, amount)
|
function contextFunc(playerColor, amount)
|
||||||
local options = { "Encounter Deck" }
|
deckData = {}
|
||||||
|
local options = {}
|
||||||
|
|
||||||
|
-- check for encounter deck
|
||||||
|
local encounterDeck = mythosAreaApi.getEncounterDeck()
|
||||||
|
if encounterDeck then
|
||||||
|
table.insert(options, "Encounter Deck")
|
||||||
|
deckData["Encounter Deck"] = { draw = encounterDeck }
|
||||||
|
end
|
||||||
|
|
||||||
-- check for players with a deck and only display them as option
|
-- check for players with a deck and only display them as option
|
||||||
for _, color in ipairs(Player.getAvailableColors()) do
|
for _, color in ipairs(Player.getAvailableColors()) do
|
||||||
@ -34,28 +33,35 @@ function contextFunc(playerColor, amount)
|
|||||||
local deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
|
local deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
|
||||||
|
|
||||||
if deckAreaObjects.draw or deckAreaObjects.topCard then
|
if deckAreaObjects.draw or deckAreaObjects.topCard then
|
||||||
table.insert(options, color)
|
local playerName = Player[color].steam_name
|
||||||
|
local invName = playermatApi.getInvestigatorName(matColor)
|
||||||
|
|
||||||
|
-- figure out a proper display name for the drop down menu
|
||||||
|
local displayName = color .. " (color)"
|
||||||
|
if playerName then
|
||||||
|
displayName = playerName
|
||||||
|
elseif invName ~= "" then
|
||||||
|
displayName = invName .. " (inv)"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- recreate table in this script to have access
|
||||||
|
deckData[displayName] = {
|
||||||
|
draw = deckAreaObjects.draw,
|
||||||
|
topCard = deckAreaObjects.topCard
|
||||||
|
}
|
||||||
|
table.insert(options, displayName)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- show the target selection dialog
|
-- show the target selection dialog
|
||||||
Player[playerColor].showOptionsDialog("Select target deck", options, _, function(owner) drawCardsFromBottom(playerColor, owner, amount) end)
|
Player[playerColor].showOptionsDialog("Select target deck", options, _,
|
||||||
|
function(owner) drawCardsFromBottom(playerColor, owner, amount) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawCardsFromBottom(playerColor, owner, amount)
|
function drawCardsFromBottom(playerColor, owner, amount)
|
||||||
-- variable initialization
|
local deckAreaObjects = deckData[owner]
|
||||||
local deck = nil
|
local deck = deckAreaObjects.draw
|
||||||
local deckSize = 1
|
local deckSize = 1
|
||||||
local deckAreaObjects = {}
|
|
||||||
|
|
||||||
-- get the respective deck
|
|
||||||
if owner == "Encounter Deck" then
|
|
||||||
deck = mythosAreaApi.getEncounterDeck()
|
|
||||||
else
|
|
||||||
local matColor = playermatApi.getMatColor(owner)
|
|
||||||
deckAreaObjects = playermatApi.getDeckAreaObjects(matColor)
|
|
||||||
deck = deckAreaObjects.draw
|
|
||||||
end
|
|
||||||
|
|
||||||
-- error handling
|
-- error handling
|
||||||
if not deck then
|
if not deck then
|
||||||
|
@ -2,6 +2,7 @@ do
|
|||||||
local PlayermatApi = {}
|
local PlayermatApi = {}
|
||||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||||
local searchLib = require("util/SearchLib")
|
local searchLib = require("util/SearchLib")
|
||||||
|
local localInvestigatorPosition = { x = -1.17, y = 1, z = -0.01 }
|
||||||
|
|
||||||
-- Convenience function to look up a mat's object by color, or get all mats.
|
-- Convenience function to look up a mat's object by color, or get all mats.
|
||||||
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
|
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
|
||||||
@ -283,7 +284,6 @@ do
|
|||||||
|
|
||||||
-- Returns a list of mat colors that have an investigator placed
|
-- Returns a list of mat colors that have an investigator placed
|
||||||
PlayermatApi.getUsedMatColors = function()
|
PlayermatApi.getUsedMatColors = function()
|
||||||
local localInvestigatorPosition = { x = -1.17, y = 1, z = -0.01 }
|
|
||||||
local usedColors = {}
|
local usedColors = {}
|
||||||
for matColor, mat in pairs(getMatForColor("All")) do
|
for matColor, mat in pairs(getMatForColor("All")) do
|
||||||
local searchPos = mat.positionToWorld(localInvestigatorPosition)
|
local searchPos = mat.positionToWorld(localInvestigatorPosition)
|
||||||
@ -295,6 +295,19 @@ do
|
|||||||
return usedColors
|
return usedColors
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Returns investigator name
|
||||||
|
---@param matColor string Color of the playmat - White, Orange, Green or Red (does not support "All")
|
||||||
|
PlayermatApi.getInvestigatorName = function(matColor)
|
||||||
|
for _, mat in pairs(getMatForColor(matColor)) do
|
||||||
|
local searchPos = mat.positionToWorld(localInvestigatorPosition)
|
||||||
|
local searchResult = searchLib.atPosition(searchPos, "isCardOrDeck")
|
||||||
|
if #searchResult == 1 then
|
||||||
|
return searchResult[1].getName()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
-- Resets the specified skill tracker to "1, 1, 1, 1"
|
-- Resets the specified skill tracker to "1, 1, 1, 1"
|
||||||
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
|
---@param matColor string Color of the playermat - White, Orange, Green, Red or All
|
||||||
PlayermatApi.resetSkillTracker = function(matColor)
|
PlayermatApi.resetSkillTracker = function(matColor)
|
||||||
|
Loading…
Reference in New Issue
Block a user