diff --git a/config.json b/config.json index 756b3ec1..9e0e2055 100644 --- a/config.json +++ b/config.json @@ -206,6 +206,17 @@ "Tokencache_Bless.8e3aab", "Tokencache_Curse.16a9a7", "Tokencache_Frost.b2b7be", + "UseCacheResource.ucacher1", + "UseCacheAmmo.ucacher2", + "UseCacheBounty.ucacher3", + "UseCacheCharge.ucacher4", + "UseCacheEvidence.ucacher5", + "UseCacheSecret.ucacher6", + "UseCacheSupply.ucacher7", + "UseCacheOffering.ucacher8", + "UseCacheClueDoom.ucachec", + "UseCacheDamage.ucached", + "UseCacheHorror.ucacheh", "PhysicsDetector.b300d8", "Neutral.834ad5", "Neutral.a84ae4", diff --git a/objects/Tokencache_-3.a7a9cb.json b/objects/Tokencache_-3.a7a9cb.json index 8da0006e..38a9a181 100644 --- a/objects/Tokencache_-3.a7a9cb.json +++ b/objects/Tokencache_-3.a7a9cb.json @@ -42,9 +42,9 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 77.999, + "posX": 78, "posY": 2.245, - "posZ": -36.001, + "posZ": -36, "rotX": 0, "rotY": 270, "rotZ": 0, diff --git a/objects/Tokencache_-5.1df0a5.json b/objects/Tokencache_-5.1df0a5.json index 6af33256..1efe9a78 100644 --- a/objects/Tokencache_-5.1df0a5.json +++ b/objects/Tokencache_-5.1df0a5.json @@ -42,9 +42,9 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 77.999, + "posX": 78, "posY": 2.145, - "posZ": -36.001, + "posZ": -36, "rotX": 0, "rotY": 270, "rotZ": 0, diff --git a/objects/Tokencache_-6.2460df.json b/objects/Tokencache_-6.2460df.json index acd7f0c3..71d4713b 100644 --- a/objects/Tokencache_-6.2460df.json +++ b/objects/Tokencache_-6.2460df.json @@ -42,9 +42,9 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 77.998, + "posX": 78, "posY": 1.345, - "posZ": -36.004, + "posZ": -36, "rotX": 0, "rotY": 270, "rotZ": 0, diff --git a/objects/Tokencache_-7.81a1d7.json b/objects/Tokencache_-7.81a1d7.json index 70bcda63..36f228f0 100644 --- a/objects/Tokencache_-7.81a1d7.json +++ b/objects/Tokencache_-7.81a1d7.json @@ -44,7 +44,7 @@ "Transform": { "posX": 78, "posY": 2.045, - "posZ": -36.001, + "posZ": -36, "rotX": 0, "rotY": 270, "rotZ": 0, diff --git a/objects/Tokencache_Bless.8e3aab.json b/objects/Tokencache_Bless.8e3aab.json index 57f88f7a..1d8a271e 100644 --- a/objects/Tokencache_Bless.8e3aab.json +++ b/objects/Tokencache_Bless.8e3aab.json @@ -42,9 +42,9 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 77.999, + "posX": 78, "posY": 1.245, - "posZ": -36.002, + "posZ": -36, "rotX": 0, "rotY": 270, "rotZ": 0, diff --git a/objects/UseCacheAmmo.ucacher2.json b/objects/UseCacheAmmo.ucacher2.json new file mode 100644 index 00000000..9f4de36f --- /dev/null +++ b/objects/UseCacheAmmo.ucacher2.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": true, + "Stretch": true, + "Thickness": 0.3, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2028355744161230067/741BC33D398801C4BC8368C345EAEF3BE2522823/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucacher2", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "ammo", + "Name": "Custom_Tile", + "Nickname": "Use Cache Ammo", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 1.545, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheBounty.ucacher3.json b/objects/UseCacheBounty.ucacher3.json new file mode 100644 index 00000000..c4e49878 --- /dev/null +++ b/objects/UseCacheBounty.ucacher3.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": true, + "Stretch": true, + "Thickness": 0.3, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2021604000335808233/22B6C4A9FEE0814E6A9BDB2C833C79D66F8100B8/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucacher3", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "bounty", + "Name": "Custom_Tile", + "Nickname": "Use Cache Bounty", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 1.6445, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheCharge.ucacher4.json b/objects/UseCacheCharge.ucacher4.json new file mode 100644 index 00000000..597eb6f7 --- /dev/null +++ b/objects/UseCacheCharge.ucacher4.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": true, + "Stretch": true, + "Thickness": 0.3, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2028355744161230179/E3A30A2D661A12205D98D4D0E374591586C5C486/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucacher4", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "charge", + "Name": "Custom_Tile", + "Nickname": "Use Cache Charge", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 1.745, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheClueDoom.ucachec.json b/objects/UseCacheClueDoom.ucachec.json new file mode 100644 index 00000000..53d50d00 --- /dev/null +++ b/objects/UseCacheClueDoom.ucachec.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": true, + "Stretch": true, + "Thickness": 0.1, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "https://i.imgur.com/EoL7yaZ.png", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357164917/1D06F1DC4D6888B6F57124BD2AFE20D0B0DA15A8/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucachec", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "clueDoom", + "Name": "Custom_Tile", + "Nickname": "Use Cache ClueDoom", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 1.345, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.25, + "scaleY": 1, + "scaleZ": 0.25 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheDamage.ucached.json b/objects/UseCacheDamage.ucached.json new file mode 100644 index 00000000..6d8e0835 --- /dev/null +++ b/objects/UseCacheDamage.ucached.json @@ -0,0 +1,65 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 15, + "Stackable": false, + "StandUp": false, + "Thickness": 0.1 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396475030/7FD93EB342AD41F973BE31894B1CE8418C6D99A3/", + "WidthScale": 0 + }, + "CustomUIAssets": [ + { + "Name": "circle", + "Type": 0, + "URL": "https://steamusercontent-a.akamaihd.net/ugc/2378549784709449995/D7C4CD08FFBFFB0A796CE3CE20B1724A8FE1F684/" + } + ], + "Description": "Left- or right-click to change the value or type numbers while hovering.", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucached", + "Grid": false, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "require(\"core/DamageHorrorCounter\")", + "LuaScriptState": "1", + "MeasureMovement": false, + "Memo": "damage", + "Name": "Custom_Token", + "Nickname": "Use Cache Damage", + "Snap": false, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": 78, + "posY": 1.145, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.3, + "scaleY": 1, + "scaleZ": 0.3 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheEvidence.ucacher5.json b/objects/UseCacheEvidence.ucacher5.json new file mode 100644 index 00000000..ce1d0978 --- /dev/null +++ b/objects/UseCacheEvidence.ucacher5.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": true, + "Stretch": true, + "Thickness": 0.3, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2021604000335808359/FA36A27E47F940D14B4C45809BF1A0CD7783C8EB/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucacher5", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "evidence", + "Name": "Custom_Tile", + "Nickname": "Use Cache Evidence", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 1.845, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheHorror.ucacheh.json b/objects/UseCacheHorror.ucacheh.json new file mode 100644 index 00000000..bf54b39f --- /dev/null +++ b/objects/UseCacheHorror.ucacheh.json @@ -0,0 +1,65 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 5, + "Stackable": false, + "StandUp": false, + "Thickness": 0.1 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2425839392396423416/9CC783AD03275AAB3443A1DACA7A58A892AAB632/", + "WidthScale": 0 + }, + "CustomUIAssets": [ + { + "Name": "circle", + "Type": 0, + "URL": "https://steamusercontent-a.akamaihd.net/ugc/2378549784709449995/D7C4CD08FFBFFB0A796CE3CE20B1724A8FE1F684/" + } + ], + "Description": "Left- or right-click to change the value or type numbers while hovering.", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucacheh", + "Grid": false, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "require(\"core/DamageHorrorCounter\")", + "LuaScriptState": "1", + "MeasureMovement": false, + "Memo": "horror", + "Name": "Custom_Token", + "Nickname": "Use Cache Horror", + "Snap": false, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": 78, + "posY": 1.245, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.3, + "scaleY": 1, + "scaleZ": 0.3 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheOffering.ucacher8.json b/objects/UseCacheOffering.ucacher8.json new file mode 100644 index 00000000..2cb56600 --- /dev/null +++ b/objects/UseCacheOffering.ucacher8.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": true, + "Stretch": true, + "Thickness": 0.3, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2342503777954079997/156B97A89D6168F1199EE2E0FE155839627C8BCD/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucacher8", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "offering", + "Name": "Custom_Tile", + "Nickname": "Use Cache Offering", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 2.145, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheResource.ucacher1.json b/objects/UseCacheResource.ucacher1.json new file mode 100644 index 00000000..525dbe53 --- /dev/null +++ b/objects/UseCacheResource.ucacher1.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": true, + "Stretch": true, + "Thickness": 0.3, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucacher1", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "resource", + "Name": "Custom_Tile", + "Nickname": "Use Cache Resource", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 1.445, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheSecret.ucacher6.json b/objects/UseCacheSecret.ucacher6.json new file mode 100644 index 00000000..44be44c1 --- /dev/null +++ b/objects/UseCacheSecret.ucacher6.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": true, + "Stretch": true, + "Thickness": 0.3, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2028355744161230311/11AD08ED0D8BF5B237444DAD0AF4F8144297A485/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucacher6", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "secret", + "Name": "Custom_Tile", + "Nickname": "Use Cache Secret", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 1.945, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/objects/UseCacheSupply.ucacher7.json b/objects/UseCacheSupply.ucacher7.json new file mode 100644 index 00000000..3f01054b --- /dev/null +++ b/objects/UseCacheSupply.ucacher7.json @@ -0,0 +1,58 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": true, + "Stretch": true, + "Thickness": 0.3, + "Type": 2 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2028355744161230402/6486457CE96C04945473D4E079CBFFAF54C7EE1B/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ucacher7", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "supply", + "Name": "Custom_Tile", + "Nickname": "Use Cache Supply", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 2.045, + "posZ": -34.6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} \ No newline at end of file diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 2a768e33..ef34d096 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -146,7 +146,7 @@ function onLoad(savedData) updateHandVisibility() updateBlurseVisibility() math.randomseed(os.time()) - TokenManager.initialiize() + TokenManager.initialize() -- add a button and context menu to the chaos token stat tracker local statTracker = guidReferenceApi.getObjectByOwnerAndType("Mythos", "StatTracker") @@ -2106,8 +2106,9 @@ end -- Token Manager --------------------------------------------------------- -function TokenManager.initialiize() +function TokenManager.initialize() TokenManager.generateOffsets(12) + TokenManager.initTokenTemplates() end -- Generates the offsets for tokens on a card (clues on locations are different and have their own function) @@ -2241,22 +2242,23 @@ function TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown return end - -- this is used to load the correct state for additional resource tokens (e.g. "Ammo") + -- if a special resource exists, spawn it directly + if stateTable[string.lower(subType or "")] then + tokenType = string.lower(subType) + end + + -- special handling for some tokens like action/ability tokens local callbackName = nil local callbackParams = nil - local stateID = stateTable[string.lower(subType or "")] - if tokenType == "resource" then - callbackName = "updateStateToken" - callbackParams = stateID - elseif tokenType == "universalActionAbility" then + if tokenType == "universalActionAbility" then local matColor = playermatApi.getMatColorByPosition(card.getPosition()) local activeInvestigatorData = playermatApi.getActiveInvestigatorData(matColor) callbackName = "updateUniversalActionAbilityToken" - callbackParams = { class = activeInvestigatorData.class, symbol = subType or activeInvestigatorData.class } - - if temporary then - callbackParams.addTag = "Temporary" - end + callbackParams = { + class = activeInvestigatorData.class, + symbol = subType, + addTag = temporary and "Temporary" or nil + } end for i = 1, tokenCount do @@ -2298,7 +2300,6 @@ function TokenManager.spawnToken(params) loadTokenType = "clueDoom" end - TokenManager.initTokenTemplates() local tokenTemplate = deepCopy(tokenTemplates[loadTokenType]) if tokenTemplate == nil then error("Unknown token type '" .. loadTokenType .. "'") @@ -2364,12 +2365,19 @@ function TokenManager.hasLocationData(card) end function TokenManager.initTokenTemplates() - if tokenTemplates ~= nil then return end tokenTemplates = {} local tokenSource = guidReferenceApi.getObjectByOwnerAndType("Mythos", "TokenSource") for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do - local tokenName = tokenTemplate.Memo - tokenTemplates[tokenName] = tokenTemplate + tokenTemplates[tokenTemplate.Memo] = tokenTemplate + end + + if tokenTemplates["resource"] ~= nil then + -- add templates for the resource token states + for subType, subTypeStateId in pairs(stateTable) do + if subTypeStateId ~= 1 then + tokenTemplates[subType] = TokenManager.getTemplateForState(subTypeStateId) + end + end end end @@ -2643,17 +2651,36 @@ end -- generates the data to spawn an infinite bag of a specific type of resources function TokenManager.getDataForInfiniteBag(params) - -- re-assign parameters for convenience - local tokenType = params.tokenType - local position = params.position - local rotation = params.rotation + local tokenTemplate = tokenTemplates[params.tokenType] + if tokenTemplate == nil then + error("Unknown token type '" .. params.tokenType .. "'") + return + end - -- make sure the token templates are initialized - TokenManager.initTokenTemplates() + -- generate and return data for the infinite bag + local properTypeName = params.tokenType:gsub("^%l", string.upper) + return { + Name = "Infinite_Bag", + Nickname = properTypeName .. " Bag", + ContainedObjects = { tokenTemplate }, + Transform = { + posX = params.position.x, + posY = params.position.y, + posZ = params.position.z, + rotX = params.rotation.x, + rotY = params.rotation.y, + rotZ = params.rotation.z, + scaleX = 1, + scaleY = 1, + scaleZ = 1 + } + } +end +-- gets the data for a specific resource token state +function TokenManager.getTemplateForState(subTypeStateId) -- create a copy of the resource token (to not modify the source) local template = deepCopy(tokenTemplates["resource"]) - local subTypeStateId = stateTable[tokenType] local subTypeData = template["States"][subTypeStateId] -- add states to data @@ -2669,24 +2696,7 @@ function TokenManager.getDataForInfiniteBag(params) subTypeData["Transform"].rotY = 0 subTypeData["Transform"].rotZ = 0 - -- generate and return data for the infinite bag - local properTypeName = tokenType:gsub("^%l", string.upper) - return { - Name = "Infinite_Bag", - Nickname = properTypeName .. " Bag", - ContainedObjects = { subTypeData }, - Transform = { - posX = position.x, - posY = position.y, - posZ = position.z, - rotX = rotation.x, - rotY = rotation.y, - rotZ = rotation.z, - scaleX = 1, - scaleY = 1, - scaleZ = 1 - } - } + return subTypeData end --------------------------------------------------------- diff --git a/src/core/UniversalActionAbilityToken.ttslua b/src/core/UniversalActionAbilityToken.ttslua index 200e8eb7..081656b8 100644 --- a/src/core/UniversalActionAbilityToken.ttslua +++ b/src/core/UniversalActionAbilityToken.ttslua @@ -44,15 +44,15 @@ local listOfSymbols = { } local colorsForClasses = { - Guardian = Color.new(19 / 255, 84 / 255, 165 / 255), - Mystic = Color.new(82 / 255, 18 / 255, 97 / 255), - Neutral = Color.new(108 / 255, 110 / 255, 112 / 255), - Rogue = Color.new(17 / 255, 72 / 255, 54 / 255), - Seeker = Color.new(215 / 255, 115 / 255, 35 / 255), - Survivor = Color.new(190 / 255, 30 / 255, 45 / 255) + Guardian = Color.new(0.0745, 0.3294, 0.6471), + Mystic = Color.new(0.3216, 0.0706, 0.3804), + Neutral = Color.new(0.4235, 0.4314, 0.4392), + Rogue = Color.new(0.0667, 0.2824, 0.2118), + Seeker = Color.new(0.8431, 0.4510, 0.1373), + Survivor = Color.new(0.7451, 0.1176, 0.1765) } -local highlightColor = { 0, 200 / 255, 200 / 255 } +local highlightColor = { 0, 0.7843, 0.7843 } function onSave() return JSON.encode({ class = class, symbol = symbol })