Merge pull request #904 from argonui/search-a-card

Search-A-Card: Added support for ID searching
This commit is contained in:
dscarpac 2024-10-06 16:47:32 -05:00 committed by GitHub
commit 66de5f3dc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 13 deletions

View File

@ -33,7 +33,7 @@
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"playercards/CardSearch\")",
"LuaScript": "require(\"playercards/Search-A-Card\")",
"LuaScriptState": "[true,false,\"\"]",
"MeasureMovement": false,
"Name": "Custom_Tile",
@ -48,9 +48,9 @@
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 4,
"scaleX": 4.5,
"scaleY": 1,
"scaleZ": 4
"scaleZ": 4.5
},
"Value": 0,
"XmlUI": ""

View File

@ -11,15 +11,15 @@ BUTTON_LABELS["search"][true] = "Name equals search term"
BUTTON_LABELS["search"][false] = "Name contains search term"
local inputParameters = {}
inputParameters.label = "Click to enter card name"
inputParameters.label = "Enter name / ID"
inputParameters.input_function = "input_func"
inputParameters.function_owner = self
inputParameters.alignment = 2
inputParameters.position = { x = 0, y = 0.1, z = -0.62 }
inputParameters.width = 3750
inputParameters.height = 380
inputParameters.font_size = 350
inputParameters.scale = { 0.1, 1, 0.1 }
inputParameters.position = { x = 0, y = 0.1, z = -0.6 }
inputParameters.width = 3500
inputParameters.height = 450
inputParameters.font_size = 400
inputParameters.scale = { 0.12, 1, 0.12 }
inputParameters.color = { 0.9, 0.7, 0.5 }
inputParameters.font_color = { 0, 0, 0 }
@ -103,11 +103,13 @@ function startSearch()
return
end
-- if the search string is a number, assume it's an ID and spawn the card directly
if tonumber(inputParameters.value) then
-- if the search string doesn't contain whitespace, attempt to treat it as ID
if not string.find(inputParameters.value, "%s") then
local singleCard = allCardsBagApi.getCardById(inputParameters.value)
spawnCardList({ singleCard })
return
if singleCard ~= nil then
spawnCardList({ singleCard })
return
end
end
-- search all objects in bag