added suzi helper

This commit is contained in:
Chr1Z93 2023-10-09 14:27:07 +02:00
parent b84309b094
commit 9ef825b048
3 changed files with 180 additions and 0 deletions

View File

@ -21,6 +21,7 @@
"DescriptivePhaseTracker.b171c8", "DescriptivePhaseTracker.b171c8",
"CustomDataHelper.2547b3", "CustomDataHelper.2547b3",
"UnderworldMarketHelper.3650ea", "UnderworldMarketHelper.3650ea",
"Subject5U-21Helper.1335e8",
"Auto-failCounter.a9a321", "Auto-failCounter.a9a321",
"ElderSignCounter.e62cb5" "ElderSignCounter.e62cb5"
], ],

View File

@ -0,0 +1,76 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"AttachedSnapPoints": [
{
"Position": {
"x": -0.5,
"y": 0.1,
"z": 0.2
}
},
{
"Position": {
"x": 0.5,
"y": 0.1,
"z": 0.2
}
}
],
"Autoraise": true,
"ColorDiffuse": {
"b": 1,
"g": 1,
"r": 1
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 3
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/2088038980375797637/86B5B03D9FC65483CD1FE25E457CE4FFADF6C8CF/",
"WidthScale": 0
},
"Description": "Place cards, decks or bags on this tile and click \"Update!\" to display the class counts.\n\nMulti-class cards are counted for all classes (so the total number will be greater than the amount of cards).",
"DragSelectable": true,
"GMNotes": "",
"GUID": "1335e8",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScriptState": "",
"LuaScript_path": "Fan-MadeAccessories.aa8b38/Subject5U-21Helper.1335e8.ttslua",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "Subject 5U-21 Helper",
"Snap": true,
"Sticky": true,
"Tags": [
"CleanUpHelper_ignore"
],
"Tooltip": true,
"Transform": {
"posX": 0,
"posY": 2,
"posZ": 0,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 4,
"scaleY": 1,
"scaleZ": 4
},
"Value": 0,
"XmlUI": ""
}

View File

@ -0,0 +1,103 @@
local classOrder = {
"Guardian",
"Seeker",
"Survivor",
"Mystic",
"Rogue"
}
local bParam = {}
bParam.width = 0
bParam.height = 0
bParam.function_owner = self
bParam.click_function = "none"
bParam.label = "0"
bParam.position = {x = 0, y = 0.1, z = -0.7}
bParam.scale = {x = 0.1, y = 0.1, z = 0.1}
bParam.font_color = "White"
bParam.font_size = 700
function onLoad()
self.createButton({
width = 2750,
height = 800,
function_owner = self,
click_function = "updateDisplayButtons",
label = "Update!",
tooltip = "Count classes from cards on this tile",
position = {x = 0, y = 0.1, z = 0.875},
scale = {x = 0.1, y = 0.1, z = 0.1},
font_size = 500
})
createDisplayButtons()
end
function createDisplayButtons()
local x_offset = 0.361
bParam.position.x = -3 * x_offset
for i = 1, 5 do
bParam.position.x = bParam.position.x + x_offset
self.createButton(bParam)
end
end
function updateDisplayButtons(_, playerColor)
local classCount = {
Guardian = 0,
Seeker = 0,
Survivor = 0,
Mystic = 0,
Rogue = 0,
uncounted = 0
}
-- loop through cards on this helper and count classes from metadata
for _, notes in ipairs(getNotesFromCardsAndContainers()) do
if notes.class then
for str in string.gmatch(notes.class, "([^|]+)") do
if not tonumber(classCount[str]) then
str = "uncounted"
end
classCount[str] = classCount[str] + 1
end
end
end
-- edit button labels with index 1-5
for i = 1, 5 do
self.editButton({index = i, label = classCount[classOrder[i]]})
end
-- show message about uncounted cards
if classCount.uncounted > 0 then
printToColor("Search included " .. classCount.uncounted .. " neutral/ununcounted card(s).", playerColor, "Orange")
end
end
function getNotesFromCardsAndContainers()
local search = Physics.cast({
direction = { 0, 1, 0 },
max_distance = 0,
type = 3,
size = self.getBounds().size:setAt("y", 1),
origin = self.getPosition() + Vector(0, 0.5, 0),
})
local notesList = {}
for _, hit in ipairs(search) do
local obj = hit.hit_object
local notes = {}
if obj.type == "Card" then
notes = JSON.decode(obj.getGMNotes()) or {}
table.insert(notesList, notes)
elseif obj.type == "Bag" or obj.type == "Deck" then
for _, deepObj in ipairs(obj.getData().ContainedObjects) do
if deepObj.Name == "Card" or deepObj.Name == "CardCustom" then
notes = JSON.decode(deepObj.GMNotes) or {}
table.insert(notesList, notes)
end
end
end
end
return notesList
end