diff --git a/modsettings/CustomUIAssets.json b/modsettings/CustomUIAssets.json index d5a6c497..402f57df 100644 --- a/modsettings/CustomUIAssets.json +++ b/modsettings/CustomUIAssets.json @@ -79,6 +79,11 @@ "Type": 1, "URL": "http://cloud-3.steamusercontent.com/ugc/2027213118466516005/113C19D37CFFA9E554394FD5B11B32967F846A62/" }, + { + "Name": "font_chinese_fzlibian", + "Type": 1, + "URL": "http://cloud-3.steamusercontent.com/ugc/2028355502896482829/8DAB311590B97586309E66D795AC2C43D4913188/" + }, { "Name": "header_cover", "Type": 0, diff --git a/objects/AllPlayerCards.15bb07/AncientCovenant2.436401.json b/objects/AllPlayerCards.15bb07/AncientCovenant2.436401.json index 14f37a92..1d4c612c 100644 --- a/objects/AllPlayerCards.15bb07/AncientCovenant2.436401.json +++ b/objects/AllPlayerCards.15bb07/AncientCovenant2.436401.json @@ -14,7 +14,7 @@ "CustomDeck": { "5464": { "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/1056604690734334657/B1BF31EBC5D92EC3A51B6D3B56ABFB232D2636C5/", + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", "FaceURL": "http://cloud-3.steamusercontent.com/ugc/1597044073918730334/45D2725C3553953A73DAFBEF631E78D459716EA7/", "NumHeight": 1, "NumWidth": 1, diff --git a/objects/AllPlayerCards.15bb07/BlasphemousCovenant2.10b087.json b/objects/AllPlayerCards.15bb07/BlasphemousCovenant2.10b087.json index 85bac647..e4f5897b 100644 --- a/objects/AllPlayerCards.15bb07/BlasphemousCovenant2.10b087.json +++ b/objects/AllPlayerCards.15bb07/BlasphemousCovenant2.10b087.json @@ -14,7 +14,7 @@ "CustomDeck": { "5465": { "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/1056604690734334657/B1BF31EBC5D92EC3A51B6D3B56ABFB232D2636C5/", + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", "FaceURL": "http://cloud-3.steamusercontent.com/ugc/1597044073918730883/0E7FEB9CC85CD11EB5194774E90A73163EDACBEC/", "NumHeight": 1, "NumWidth": 1, diff --git a/objects/AllPlayerCards.15bb07/EldritchSophist.f6b1b6.json b/objects/AllPlayerCards.15bb07/EldritchSophist.f6b1b6.json index e71d7f82..bf79edf0 100644 --- a/objects/AllPlayerCards.15bb07/EldritchSophist.f6b1b6.json +++ b/objects/AllPlayerCards.15bb07/EldritchSophist.f6b1b6.json @@ -14,7 +14,7 @@ "CustomDeck": { "5493": { "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/766099859120034153/D864BCCCC1C811EC7F0AED69D1C30C678D3D9FC9/", + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", "FaceURL": "http://cloud-3.steamusercontent.com/ugc/1537373727958826520/EE54EF6510734FC86ADD47E84DB253493A2F87B7/", "NumHeight": 1, "NumWidth": 1, diff --git a/objects/AllPlayerCards.15bb07/Skeptic1.d2cd42.json b/objects/AllPlayerCards.15bb07/Skeptic1.d2cd42.json index bb3e660e..4c2edbe4 100644 --- a/objects/AllPlayerCards.15bb07/Skeptic1.d2cd42.json +++ b/objects/AllPlayerCards.15bb07/Skeptic1.d2cd42.json @@ -14,7 +14,7 @@ "CustomDeck": { "5501": { "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/1537373966843931844/D864BCCCC1C811EC7F0AED69D1C30C678D3D9FC9/", + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", "FaceURL": "http://cloud-3.steamusercontent.com/ugc/1537373966843940006/71700050B0B2CD56C458047D94B9E605ED01B989/", "NumHeight": 1, "NumWidth": 1, diff --git a/objects/Resourcetokens.0168ae.json b/objects/Resourcetokens.0168ae.json index 63bbec62..fb18bca2 100644 --- a/objects/Resourcetokens.0168ae.json +++ b/objects/Resourcetokens.0168ae.json @@ -11,7 +11,7 @@ "r": 0.28224 }, "ContainedObjects_order": [ - "Custom_Token.00d19a" + "Resource.4cd3f6" ], "ContainedObjects_path": "Resourcetokens.0168ae", "CustomMesh": { diff --git a/objects/Resourcetokens.0168ae/Custom_Token.00d19a.json b/objects/Resourcetokens.0168ae/Custom_Token.00d19a.json deleted file mode 100644 index b11264f0..00000000 --- a/objects/Resourcetokens.0168ae/Custom_Token.00d19a.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "CustomImage": { - "CustomToken": { - "MergeDistancePixels": 5, - "Stackable": true, - "StandUp": false, - "Thickness": 0.3 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "00d19a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Memo": "resource", - "Name": "Custom_Token", - "Nickname": "", - "Snap": false, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -44.498, - "posY": 1.781, - "posZ": 26.817, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 0.17, - "scaleY": 0.17, - "scaleZ": 0.17 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Resourcetokens.0168ae/Resource.4cd3f6.json b/objects/Resourcetokens.0168ae/Resource.4cd3f6.json new file mode 100644 index 00000000..dd69e8d3 --- /dev/null +++ b/objects/Resourcetokens.0168ae/Resource.4cd3f6.json @@ -0,0 +1,292 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 5, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "4cd3f6", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "resource", + "Name": "Custom_Token", + "Nickname": "Resource", + "Snap": false, + "States": { + "2": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230067/741BC33D398801C4BC8368C345EAEF3BE2522823/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "00d19a", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "ammo", + "Name": "Custom_Token", + "Nickname": "Ammo", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "3": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230179/E3A30A2D661A12205D98D4D0E374591586C5C486/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "a5ce94", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "charge", + "Name": "Custom_Token", + "Nickname": "Charge", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "4": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230311/11AD08ED0D8BF5B237444DAD0AF4F8144297A485/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "7a4a9a", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "secret", + "Name": "Custom_Token", + "Nickname": "Secret", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "5": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230402/6486457CE96C04945473D4E079CBFFAF54C7EE1B/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "2b4628", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "supply", + "Name": "Custom_Token", + "Nickname": "Supply", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + } + }, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} diff --git a/objects/Resourcetokens.9fadf9.json b/objects/Resourcetokens.9fadf9.json index 890d60af..55c3d090 100644 --- a/objects/Resourcetokens.9fadf9.json +++ b/objects/Resourcetokens.9fadf9.json @@ -11,7 +11,7 @@ "r": 0.28224 }, "ContainedObjects_order": [ - "Custom_Token.00d19a" + "Resource.4cd3f6" ], "ContainedObjects_path": "Resourcetokens.9fadf9", "CustomMesh": { diff --git a/objects/Resourcetokens.9fadf9/Custom_Token.00d19a.json b/objects/Resourcetokens.9fadf9/Custom_Token.00d19a.json deleted file mode 100644 index baaf2ef0..00000000 --- a/objects/Resourcetokens.9fadf9/Custom_Token.00d19a.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "CustomImage": { - "CustomToken": { - "MergeDistancePixels": 5, - "Stackable": true, - "StandUp": false, - "Thickness": 0.3 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "00d19a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Memo": "resource", - "Name": "Custom_Token", - "Nickname": "", - "Snap": false, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -50.897, - "posY": 1.781, - "posZ": -1.283, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 0.17, - "scaleY": 0.17, - "scaleZ": 0.17 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Resourcetokens.9fadf9/Resource.4cd3f6.json b/objects/Resourcetokens.9fadf9/Resource.4cd3f6.json new file mode 100644 index 00000000..dd69e8d3 --- /dev/null +++ b/objects/Resourcetokens.9fadf9/Resource.4cd3f6.json @@ -0,0 +1,292 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 5, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "4cd3f6", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "resource", + "Name": "Custom_Token", + "Nickname": "Resource", + "Snap": false, + "States": { + "2": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230067/741BC33D398801C4BC8368C345EAEF3BE2522823/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "00d19a", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "ammo", + "Name": "Custom_Token", + "Nickname": "Ammo", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "3": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230179/E3A30A2D661A12205D98D4D0E374591586C5C486/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "a5ce94", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "charge", + "Name": "Custom_Token", + "Nickname": "Charge", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "4": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230311/11AD08ED0D8BF5B237444DAD0AF4F8144297A485/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "7a4a9a", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "secret", + "Name": "Custom_Token", + "Nickname": "Secret", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "5": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230402/6486457CE96C04945473D4E079CBFFAF54C7EE1B/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "2b4628", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "supply", + "Name": "Custom_Token", + "Nickname": "Supply", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + } + }, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} diff --git a/objects/Resourcetokens.fd617a.json b/objects/Resourcetokens.fd617a.json index 803e5802..f6377cc7 100644 --- a/objects/Resourcetokens.fd617a.json +++ b/objects/Resourcetokens.fd617a.json @@ -11,7 +11,7 @@ "r": 0.28224 }, "ContainedObjects_order": [ - "Custom_Token.00d19a" + "Resource.4cd3f6" ], "ContainedObjects_path": "Resourcetokens.fd617a", "CustomMesh": { diff --git a/objects/Resourcetokens.fd617a/Custom_Token.00d19a.json b/objects/Resourcetokens.fd617a/Custom_Token.00d19a.json deleted file mode 100644 index 235ea690..00000000 --- a/objects/Resourcetokens.fd617a/Custom_Token.00d19a.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "CustomImage": { - "CustomToken": { - "MergeDistancePixels": 5, - "Stackable": true, - "StandUp": false, - "Thickness": 0.3 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "00d19a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Memo": "resource", - "Name": "Custom_Token", - "Nickname": "", - "Snap": false, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -42.682, - "posY": 1.763, - "posZ": -26.327, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 0.17, - "scaleY": 0.17, - "scaleZ": 0.17 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/Resourcetokens.fd617a/Resource.4cd3f6.json b/objects/Resourcetokens.fd617a/Resource.4cd3f6.json new file mode 100644 index 00000000..dd69e8d3 --- /dev/null +++ b/objects/Resourcetokens.fd617a/Resource.4cd3f6.json @@ -0,0 +1,292 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 5, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "4cd3f6", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "resource", + "Name": "Custom_Token", + "Nickname": "Resource", + "Snap": false, + "States": { + "2": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230067/741BC33D398801C4BC8368C345EAEF3BE2522823/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "00d19a", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "ammo", + "Name": "Custom_Token", + "Nickname": "Ammo", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "3": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230179/E3A30A2D661A12205D98D4D0E374591586C5C486/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "a5ce94", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "charge", + "Name": "Custom_Token", + "Nickname": "Charge", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "4": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230311/11AD08ED0D8BF5B237444DAD0AF4F8144297A485/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "7a4a9a", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "secret", + "Name": "Custom_Token", + "Nickname": "Secret", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "5": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230402/6486457CE96C04945473D4E079CBFFAF54C7EE1B/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "2b4628", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "supply", + "Name": "Custom_Token", + "Nickname": "Supply", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + } + }, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} diff --git a/objects/TokenSource.124381.json b/objects/TokenSource.124381.json index c3678f5e..7b6b34fb 100644 --- a/objects/TokenSource.124381.json +++ b/objects/TokenSource.124381.json @@ -14,11 +14,11 @@ "r": 0.15842 }, "ContainedObjects_order": [ + "ClueDoom.a3fb6c", "Damage.cd2a02", "Horror.36be72", - "ClueDoom.a3fb6c", "Path.7234af", - "Resource.00d19a", + "Resource.910e09", "ResourceCounter.498ec0" ], "ContainedObjects_path": "TokenSource.124381", diff --git a/objects/TokenSource.124381/ClueDoom.a3fb6c.json b/objects/TokenSource.124381/ClueDoom.a3fb6c.json index b246be24..e1434ece 100644 --- a/objects/TokenSource.124381/ClueDoom.a3fb6c.json +++ b/objects/TokenSource.124381/ClueDoom.a3fb6c.json @@ -46,8 +46,8 @@ "posX": 78.661, "posY": 2.398, "posZ": -1.064, - "rotX": 8, - "rotY": 90, + "rotX": 0, + "rotY": 270, "rotZ": 0, "scaleX": 0.25, "scaleY": 1, diff --git a/objects/TokenSource.124381/Resource.00d19a.json b/objects/TokenSource.124381/Resource.00d19a.json deleted file mode 100644 index bd8f457a..00000000 --- a/objects/TokenSource.124381/Resource.00d19a.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "CustomImage": { - "CustomToken": { - "MergeDistancePixels": 5, - "Stackable": true, - "StandUp": false, - "Thickness": 0.3 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "00d19a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Memo": "resource", - "Name": "Custom_Token", - "Nickname": "Resource", - "Snap": false, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 78.848, - "posY": 2.273, - "posZ": -1.469, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 0.17, - "scaleY": 0.17, - "scaleZ": 0.17 - }, - "Value": 0, - "XmlUI": "" -} diff --git a/objects/TokenSource.124381/Resource.910e09.json b/objects/TokenSource.124381/Resource.910e09.json new file mode 100644 index 00000000..1ad43c58 --- /dev/null +++ b/objects/TokenSource.124381/Resource.910e09.json @@ -0,0 +1,292 @@ +{ + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 5, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "910e09", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "resource", + "Name": "Custom_Token", + "Nickname": "Resource", + "Snap": false, + "States": { + "2": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230067/741BC33D398801C4BC8368C345EAEF3BE2522823/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "00d19a", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "ammo", + "Name": "Custom_Token", + "Nickname": "Ammo", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "3": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230179/E3A30A2D661A12205D98D4D0E374591586C5C486/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "a5ce94", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "charge", + "Name": "Custom_Token", + "Nickname": "Charge", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "4": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230311/11AD08ED0D8BF5B237444DAD0AF4F8144297A485/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "7a4a9a", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "secret", + "Name": "Custom_Token", + "Nickname": "Secret", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + }, + "5": { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomToken": { + "MergeDistancePixels": 10, + "Stackable": true, + "StandUp": false, + "Thickness": 0.3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2028355744161230402/6486457CE96C04945473D4E079CBFFAF54C7EE1B/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "2b4628", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Memo": "supply", + "Name": "Custom_Token", + "Nickname": "Supply", + "Snap": false, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" + } + }, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 44, + "posY": 1.5, + "posZ": 8, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.17, + "scaleY": 0.17, + "scaleZ": 0.17 + }, + "Value": 0, + "XmlUI": "" +} diff --git a/src/accessories/TokenArranger.ttslua b/src/accessories/TokenArranger.ttslua index e167d79c..ab40d7a2 100644 --- a/src/accessories/TokenArranger.ttslua +++ b/src/accessories/TokenArranger.ttslua @@ -20,7 +20,6 @@ inputParameters.tab = 2 -- variables with save function local tokenPrecedence = {} -local latestLoad = "XXX" local percentage = false -- variables without save function @@ -42,7 +41,6 @@ local TOKEN_NAMES = { function onSave() return JSON.encode({ tokenPrecedence = tokenPrecedence, - latestLoad = latestLoad, percentage = percentage }) end @@ -52,10 +50,12 @@ function onLoad(saveState) if saveState ~= nil and saveState ~= "" then local loadedData = JSON.decode(saveState) tokenPrecedence = loadedData.tokenPrecedence - latestLoad = loadedData.latestLoad or "XXX" percentage = loadedData.percentage else loadDefaultValues() + + -- grab token metadata from mythos area + Wait.time(function() onTokenDataChanged(mythosAreaApi.returnTokenData()) end, 0.2) end createButtonsAndInputs(true) @@ -63,7 +63,6 @@ function onLoad(saveState) -- context menu items self.addContextMenuItem("Load default values", function() - latestLoad = "XXX" loadDefaultValues() updateUI() layout() @@ -90,9 +89,6 @@ function onLoad(saveState) "Yellow") layout() end) - - -- grab token metadata from mythos area - Wait.time(function() onTokenDataChanged(mythosAreaApi.returnTokenData()) end, 0.2) end -- delete temporary tokens when destroyed @@ -383,11 +379,6 @@ function onTokenDataChanged(parameters) local currentScenario = parameters.currentScenario or "" local useFrontData = parameters.useFrontData - -- only update if this data is new - local info = currentScenario .. tostring(useFrontData) - if latestLoad == info then return end - latestLoad = info - -- update token precedence for key, table in pairs(tokenData) do local modifier = table.modifier diff --git a/src/arkhamdb/ArkhamDb.ttslua b/src/arkhamdb/ArkhamDb.ttslua index 769b460d..74392dea 100644 --- a/src/arkhamdb/ArkhamDb.ttslua +++ b/src/arkhamdb/ArkhamDb.ttslua @@ -199,7 +199,7 @@ do local altArt = { front = "normal", back = "normal" } -- translating front ID - if altFrontId > 90000 and altFrontId < 90006 then + if altFrontId > 90000 and altFrontId < 90038 then altArt.front = "parallel" elseif altFrontId > 01500 and altFrontId < 01506 then altArt.front = "revised" @@ -208,7 +208,7 @@ do end -- translating back ID - if altBackId > 90000 and altBackId < 90006 then + if altBackId > 90000 and altBackId < 90038 then altArt.back = "parallel" elseif altBackId > 01500 and altBackId < 01506 then altArt.back = "revised" diff --git a/src/arkhamdb/DeckImporterMain.ttslua b/src/arkhamdb/DeckImporterMain.ttslua index c4b0d56f..1d69787c 100644 --- a/src/arkhamdb/DeckImporterMain.ttslua +++ b/src/arkhamdb/DeckImporterMain.ttslua @@ -6,44 +6,8 @@ local playAreaApi = require("core/PlayAreaApi") local arkhamDb = require("arkhamdb/ArkhamDb") local zones = require("playermat/Zones") -local DEBUG = false - local ALL_CARDS_GUID = "15bb07" -local customizationRowsWithFields = { } --- inputMap maps from (our 1-indexes) customization row index to inputValue table index --- The Raven Quill -customizationRowsWithFields["09042"] = {} -customizationRowsWithFields["09042"].inputCount = 2 -customizationRowsWithFields["09042"].inputMap = {} -customizationRowsWithFields["09042"].inputMap[1] = 1 -customizationRowsWithFields["09042"].inputMap[5] = 2 --- Friends in Low Places -customizationRowsWithFields["09060"] = {} -customizationRowsWithFields["09060"].inputCount = 2 -customizationRowsWithFields["09060"].inputMap = {} -customizationRowsWithFields["09060"].inputMap[1] = 1 -customizationRowsWithFields["09060"].inputMap[3] = 2 --- Living Ink -customizationRowsWithFields["09079"] = {} -customizationRowsWithFields["09079"].inputCount = 3 -customizationRowsWithFields["09079"].inputMap = {} -customizationRowsWithFields["09079"].inputMap[1] = 1 -customizationRowsWithFields["09079"].inputMap[5] = 2 -customizationRowsWithFields["09079"].inputMap[6] = 3 --- Summoned Servitor -customizationRowsWithFields["09080"] = {} -customizationRowsWithFields["09080"].inputCount = 1 -customizationRowsWithFields["09080"].inputMap = {} -customizationRowsWithFields["09080"].inputMap[6] = 1 --- Grizzled -customizationRowsWithFields["09101"] = {} -customizationRowsWithFields["09101"].inputCount = 3 -customizationRowsWithFields["09101"].inputMap = {} -customizationRowsWithFields["09101"].inputMap[1] = 1 -customizationRowsWithFields["09101"].inputMap[2] = 2 -customizationRowsWithFields["09101"].inputMap[3] = 3 - function onLoad(script_state) initializeUi(JSON.decode(script_state)) math.randomseed(os.time()) @@ -142,6 +106,8 @@ function loadCards(slots, investigatorId, bondedList, customizations, playerColo if (zone == "SetAside4") then -- SetAside4 is reserved for customization cards, and we want them spread on the table -- so their checkboxes are visible + -- TO-DO: take into account that spreading will make multiple rows + -- (this is affected by the user's local settings!) if (playerColor == "White") then deckPos.z = deckPos.z + (#zoneCards - 1) * spreadDistance elseif (playerColor == "Green") then @@ -197,7 +163,7 @@ function deckSpawned(deck, playerColor) end end --- Conver the Raven Quill's selections from card IDs to card names. This could be more elegant +-- Converts the Raven Quill's selections from card IDs to card names. This could be more elegant -- but the inputs are very static so we're using some brute force. ---@param selectionString String provided by ArkhamDB, indicates the customization selections -- Should be either a single card ID or two separated by a ^ (e.g. XXXXX^YYYYY) @@ -209,10 +175,17 @@ function convertRavenQuillSelections(selectionString) end end +-- Converts Grizzled's selections from a single string with "^". +---@param selectionString String provided by ArkhamDB, indicates the customization selections +-- Should be two Traits separated by a ^ (e.g. XXXXX^YYYYY) +function convertGrizzledSelections(selectionString) + return selectionString:gsub("%^", ", ") +end + -- Returns the simple name of a card given its ID. This will find the card and strip any trailing -- SCED-specific suffixes such as (Taboo) or (Level) function getCardName(cardId) - local allCardsBag = getObjectFromGUID("15bb07") + local allCardsBag = getObjectFromGUID(ALL_CARDS_GUID) local card = allCardsBag.call("getCardById", { id = cardId }) if (card ~= nil) then local name = card.data.Nickname @@ -360,65 +333,60 @@ function handleCustomizableUpgrades(cardList, customizations) if card.metadata.type == "UpgradeSheet" then local baseId = string.sub(card.metadata.id, 1, 5) local upgrades = customizations["cus_" .. baseId] - log(upgrades) - log(baseId) if upgrades ~= nil then -- initialize tables -- markedBoxes: contains the amount of markedBoxes (left to right) per row (starting at row 1) -- inputValues: contains the amount of inputValues per row (starting at row 0) - local markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - local inputValues = {} + local selectedUpgrades = { } local index_xp = {} -- get the index and xp values (looks like this: X|X,X|X, ..) + -- input string from ArkhamDB is split by "," for str in string.gmatch(customizations["cus_" .. baseId], "([^,]+)") do table.insert(index_xp, str) end -- split each pair and assign it to the proper position in markedBoxes - if (customizationRowsWithFields[baseId] ~= nil) then - for i = 1, customizationRowsWithFields[baseId].inputCount do - table.insert(inputValues, "") - end - end - for key, value in pairs(inputValues) do - log("Key " .. key.." Value " .. value) - end - local inputCount = 0 for _, entry in ipairs(index_xp) do + -- counter increments from 1 to 3 and indicates the part of the string we are on + -- usually: 1 = row, 2 = amount of check boxes, 3 = entry in inputfield local counter = 0 - local index = 0 + local row = 0 - -- if found number is 0, then only get inputvalue - for str in string.gmatch(entry, "([^|]+)") do + -- parsing the string for each row + for str in entry:gmatch("([^|]+)") do counter = counter + 1 + if counter == 1 then - index = tonumber(str) + 1 + row = tonumber(str) + 1 elseif counter == 2 then - markedBoxes[index] = tonumber(str) + if selectedUpgrades[row] == nil then + selectedUpgrades[row] = { } + end + selectedUpgrades[row].xp = tonumber(str) elseif counter == 3 and str ~= "" then - if (baseId == "09042") then - inputValues[customizationRowsWithFields[baseId].inputMap[index]] = convertRavenQuillSelections(str) - elseif customizationRowsWithFields[baseId] ~= nil then - inputValues[customizationRowsWithFields[baseId].inputMap[index]] = str - log(str) + if baseId == "09042" then + selectedUpgrades[row].text = convertRavenQuillSelections(str) + elseif baseId == "09101" then + selectedUpgrades[row].text = convertGrizzledSelections(str) + elseif baseId == "09079" then -- Living Ink skill selection + -- All skills, regardless of row, are placed in upgrade slot 1 as a comma-delimited + -- list + if selectedUpgrades[1].text == nil then + selectedUpgrades[1].text = str + else + selectedUpgrades[1].text = selectedUpgrades[1].text .. "," .. str + end + else + selectedUpgrades[row].text = str end end end end - -- remove first entry in markedBoxes if row 0 has textbox - if customizationRowsWithFields[baseId] ~= nil and customizationRowsWithFields[baseId].inputCount > 0 then - if (baseId == "09080" and markedBoxes[6] == 2 and inputValues[customizationRowsWithFields[baseId].inputMap[6]] == "") then - inputValues[customizationRowsWithFields[baseId].inputMap[6]] = "0" - else - table.remove(markedBoxes, 1) - end - end - -- write the loaded values to the save_data of the sheets - card.data["LuaScriptState"] = JSON.encode({ markedBoxes, inputValues }) + card.data["LuaScriptState"] = JSON.encode({ selections = selectedUpgrades }) end end end @@ -440,7 +408,3 @@ function loadAltArt(card, loadAltInvestigator) card.setState(#states) end end - -function log(message) - if DEBUG then print(message) end -end diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 00ce5f69..ede49641 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -122,6 +122,7 @@ function onLoad(savedData) if obj ~= nil then obj.interactable = false end end + resetChaosTokenStatTracker() getModVersion() math.randomseed(os.time()) end @@ -353,42 +354,67 @@ end -- Left-click: print stats, Right-click: reset stats function handleStatTrackerClick(_, _, isRightClick) if isRightClick then - for key, _ in pairs(tokenDrawingStats) do - tokenDrawingStats[key] = {} - end + resetChaosTokenStatTracker() else local squidKing = "Nobody" local maxSquid = 0 - local playerColor, playerName - - for key, personalStats in pairs(tokenDrawingStats) do - if personalStats ~= {} then - if key == "Overall" then - playerColor = "White" - playerName = "Overall" - else - playerColor = playmatApi.getPlayerColor(MAT_GUID_TO_COLOR[key]) - playerName = Player[playerColor].steam_name or playerColor + local foundAnyStats = false - local playerSquidCount = personalStats["Auto-fail"] or 0 - if playerSquidCount > maxSquid then - squidKing = playerName - maxSquid = playerSquidCount - end + for key, personalStats in pairs(tokenDrawingStats) do + local playerColor, playerName + + if key == "Overall" then + playerColor = "White" + playerName = "Overall" + else + playerColor = playmatApi.getPlayerColor(MAT_GUID_TO_COLOR[key]) + playerName = Player[playerColor].steam_name or playerColor + + local playerSquidCount = personalStats["Auto-fail"] + if playerSquidCount > maxSquid then + squidKing = playerName + maxSquid = playerSquidCount end - + end + + -- get the total count of drawn tokens for the player + local totalCount = 0 + for tokenName, value in pairs(personalStats) do + totalCount = totalCount + value + end + + -- only print the personal stats if any tokens were drawn + if totalCount > 0 then + foundAnyStats = true printToAll("------------------------------") printToAll(playerName .. " Stats", playerColor) - + for tokenName, value in pairs(personalStats) do - if value then + if value ~= 0 then printToAll(tokenName .. ': ' .. tostring(value)) end end + printToAll('Total: ' .. tostring(totalCount)) end end - printToAll("------------------------------") - printToAll(squidKing .. " is an auto-fail magnet.", {255, 0, 0}) + + -- detect if any player drew tokens + if foundAnyStats then + printToAll("------------------------------") + printToAll(squidKing .. " is an auto-fail magnet.", {255, 0, 0}) + else + printToAll("No tokens have been drawn yet.", "Yellow") + end + end +end + +-- resets the count for each token to 0 +function resetChaosTokenStatTracker() + for key, _ in pairs(tokenDrawingStats) do + tokenDrawingStats[key] = {} + for _, token in pairs(ID_URL_MAP) do + tokenDrawingStats[key][token.name] = 0 + end end end diff --git a/src/core/MythosArea.ttslua b/src/core/MythosArea.ttslua index fd0c7117..57455b30 100644 --- a/src/core/MythosArea.ttslua +++ b/src/core/MythosArea.ttslua @@ -43,37 +43,28 @@ end -- TTS event handler. Handles scenario name event triggering and encounter card token resets. function onCollisionEnter(collisionInfo) - if not collisionEnabled then - return - end + if not collisionEnabled then return end local object = collisionInfo.collision_object + if object.getName() == "Scenario" then - local updateNeeded = false local description = object.getDescription() - -- detect if orientation of scenario card changed (flipped to other side) - if object.is_face_down == useFrontData then - useFrontData = not useFrontData - updateNeeded = true - end - - -- detect if another scenario card is placed down + -- detect if a new scenario card is placed down if currentScenario ~= description then currentScenario = description - updateNeeded = true fireScenarioChangedEvent() end - -- trigger update if a change was detected and push new data - if updateNeeded then - local metadata = JSON.decode(object.getGMNotes()) or {} - if not metadata["tokens"] then - tokenData = {} - return - end - tokenData = metadata["tokens"][(useFrontData and "front" or "back")] - fireTokenDataChangedEvent() + local metadata = JSON.decode(object.getGMNotes()) or {} + if not metadata["tokens"] then + tokenData = {} + return end + + -- detect orientation of scenario card (for difficulty) + useFrontData = not object.is_face_down + tokenData = metadata["tokens"][(useFrontData and "front" or "back")] + fireTokenDataChangedEvent() end local localPos = self.positionToLocal(object.getPosition()) diff --git a/src/core/token/TokenManager.ttslua b/src/core/token/TokenManager.ttslua index 8bcfb6fe..231b5717 100644 --- a/src/core/token/TokenManager.ttslua +++ b/src/core/token/TokenManager.ttslua @@ -107,6 +107,14 @@ do } } + -- stateIDs for the multi-stated resource tokens + local stateTable = { + ["Ammo"] = 2, + ["Charge"] = 3, + ["Secret"] = 4, + ["Supply"] = 5 + } + -- Source for tokens local TOKEN_SOURCE_GUID = "124381" @@ -148,7 +156,8 @@ do ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the -- spawned state object rather than spawning multiple tokens ---@param shiftDown Number An offset for the z-value of this group of tokens - TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown) + ---@param stateID Number Index of the state to load for this token + TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, stateID) local optionPanel = Global.getTable("optionPanel") if tokenType == "damage" or tokenType == "horror" then @@ -156,7 +165,7 @@ do elseif tokenType == "resource" and optionPanel["useResourceCounters"] then TokenManager.spawnResourceCounterToken(card, tokenCount) else - TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown) + TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, stateID) end end @@ -187,7 +196,8 @@ do -- Other types should use spawnCounterToken() ---@param tokenCount Number How many tokens to spawn ---@param shiftDown Number An offset for the z-value of this group of tokens - TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown) + ---@param stateID Number Index of the state to load for this token + TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, stateID) if tokenCount < 1 or tokenCount > 12 then return end @@ -219,8 +229,14 @@ do return end + -- this is used to load the correct state for additional resource tokens (e.g. "Ammo") + local callback = nil + if tokenType == "resource" and stateID ~= nil then + callback = function(spawned) spawned.setState(stateID) end + end + for i = 1, tokenCount do - TokenManager.spawnToken(offsets[i], tokenType, card.getRotation()) + TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback) end end @@ -325,38 +341,20 @@ do --- spawned for that type. e.g. Akachi's playmat should pass "Charge"=1 internal.spawnTokensFromUses = function(card, extraUses) local uses = internal.getUses(card) - if uses == nil then - return - end - local type = nil - local token = nil - local tokenCount = 0 - -- Uses structure underwent a breaking change in 2.4.0, have to check to see if this is - -- a single entry or an array. This is ugly and duplicated, but impossible to replicate the - -- multi-spawn vs. single spawn otherwise. TODO: Clean this up when 2.4.0 has been out long - -- enough that saved decks don't have old data - if uses.count != nil then - type = cardMetadata.uses.type - token = cardMetadata.uses.token - tokenCount = cardMetadata.uses.count + if uses == nil then return end + + -- go through tokens to spawn + local type, token, tokenCount + for i, useInfo in ipairs(uses) do + type = useInfo.type + token = useInfo.token + tokenCount = (useInfo.count or 0) + + (useInfo.countPerInvestigator or 0) * playArea.getInvestigatorCount() if extraUses ~= nil and extraUses[type] ~= nil then tokenCount = tokenCount + extraUses[type] end - --log("Spawning single use tokens for "..card.getName()..'['..card.getDescription()..']: '..tokenCount.."x "..token) - TokenManager.spawnTokenGroup(card, token, tokenCount) - else - for i, useInfo in ipairs(uses) do - type = useInfo.type - token = useInfo.token - tokenCount = (useInfo.count or 0) - + (useInfo.countPerInvestigator or 0) * playArea.getInvestigatorCount() - if extraUses ~= nil and extraUses[type] ~= nil then - tokenCount = tokenCount + extraUses[type] - end - --log("Spawning use array tokens for "..card.getName()..'['..card.getDescription()..']: '..tokenCount.."x "..token) - -- Shift each spawned group after the first down so they don't pile on each other - TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8) - end + -- Shift each spawned group after the first down so they don't pile on each other + TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, stateTable[type]) end tokenSpawnTracker.markTokensSpawned(card.getGUID()) end @@ -463,5 +461,4 @@ do end return TokenManager - end diff --git a/src/playercards/customizable/AlchemicalDistillationUpgradeSheet.ttslua b/src/playercards/customizable/AlchemicalDistillationUpgradeSheet.ttslua index 95ecd11f..2fb05f63 100644 --- a/src/playercards/customizable/AlchemicalDistillationUpgradeSheet.ttslua +++ b/src/playercards/customizable/AlchemicalDistillationUpgradeSheet.ttslua @@ -1,19 +1,11 @@ -- Customizable Cards: Alchemical Distillation --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} - -- Color information for buttons boxSize = 40 -- static values -x_1 = -0.933 -x_offset = 0.075 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.933 +xOffset = 0.075 -- z-values (lines on the sheet) posZ = { @@ -28,154 +20,51 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 1, 1, 1, 2, 4, 5 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" +customizations = { + [1] = { + checkboxes = { + posZ = -0.892, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.665, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.43, + count = 1, + } + }, + [4] = { + checkboxes = { + posZ = -0.092, + count = 2, + } + }, + [5] = { + checkboxes = { + posZ = 0.142, + count = 2, + }, + }, + [6] = { + checkboxes = { + posZ = 0.376, + count = 4, + } + }, + [7] = { + checkboxes = { + posZ = 0.815, + count = 5, + } + }, +} --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/CustomModificationsUpgradeSheet.ttslua b/src/playercards/customizable/CustomModificationsUpgradeSheet.ttslua index 1e0e5350..c23baac4 100644 --- a/src/playercards/customizable/CustomModificationsUpgradeSheet.ttslua +++ b/src/playercards/customizable/CustomModificationsUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Custom Modifications --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 38 -- static values -x_1 = -0.935 -x_offset = 0.0735 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.0735 -- z-values (lines on the sheet) posZ = { @@ -26,154 +19,45 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 2, 2, 3, 3, 4 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" +customizations = { + [1] = { + checkboxes = { + posZ = -0.895, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.455, + count = 2, + } + }, + [3] = { + checkboxes = { + posZ = -0.215, + count = 2, + } + }, + [4] = { + checkboxes = { + posZ = 0.115, + count = 3, + } + }, + [5] = { + checkboxes = { + posZ = 0.453, + count = 3, + }, + }, + [6] = { + checkboxes = { + posZ = 0.794, + count = 4, + } + }, +} --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/DamningTestimonyUpgradeSheet.ttslua b/src/playercards/customizable/DamningTestimonyUpgradeSheet.ttslua index 77255bfb..8bfc50a0 100644 --- a/src/playercards/customizable/DamningTestimonyUpgradeSheet.ttslua +++ b/src/playercards/customizable/DamningTestimonyUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Damning Testimony --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 40 -- static values -x_1 = -0.935 -x_offset = 0.075 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.075 -- z-values (lines on the sheet) posZ = { @@ -26,154 +19,44 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 2, 2, 3, 3, 4 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" - --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +customizations = { + [1] = { + checkboxes = { + posZ = -0.925, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.475, + count = 2, + } + }, + [3] = { + checkboxes = { + posZ = -0.25, + count = 2, + } + }, + [4] = { + checkboxes = { + posZ = -0.01, + count = 3, + } + }, + [5] = { + checkboxes = { + posZ = 0.428, + count = 3, + }, + }, + [6] = { + checkboxes = { + posZ = 0.772, + count = 4, + } + }, +} +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/EmpiricalHypothesisUpgradeSheet.ttslua b/src/playercards/customizable/EmpiricalHypothesisUpgradeSheet.ttslua index b3123175..8ffbffa5 100644 --- a/src/playercards/customizable/EmpiricalHypothesisUpgradeSheet.ttslua +++ b/src/playercards/customizable/EmpiricalHypothesisUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Empirical Hypothesis --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 37 -- static values -x_1 = -0.935 -x_offset = 0.069 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.069 -- z-values (lines on the sheet) posZ = { @@ -28,154 +21,56 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 1, 1, 1, 2, 2, 3, 4 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" - --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +customizations = { + [1] = { + checkboxes = { + posZ = -0.905, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.7, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.505, + count = 1, + } + }, + [4] = { + checkboxes = { + posZ = -0.3, + count = 1, + } + }, + [5] = { + checkboxes = { + posZ = -0.09, + count = 2, + }, + }, + [6] = { + checkboxes = { + posZ = 0.3, + count = 2, + } + }, + [7] = { + checkboxes = { + posZ = 0.592, + count = 3, + }, + }, + [8] = { + checkboxes = { + posZ = 0.888, + count = 4, + } + }, +} +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/FriendsinLowPlacesUpgradeSheet.ttslua b/src/playercards/customizable/FriendsinLowPlacesUpgradeSheet.ttslua index 8f1cae92..64550c0b 100644 --- a/src/playercards/customizable/FriendsinLowPlacesUpgradeSheet.ttslua +++ b/src/playercards/customizable/FriendsinLowPlacesUpgradeSheet.ttslua @@ -1,19 +1,12 @@ -- Customizable Cards: Friends in Low Places --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons and input boxes boxSize = 36 inputFontsize = 50 -- static values -x_1 = -0.935 -x_offset = 0.0685 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.0685 -- z-values (lines on the sheet) posZ = { @@ -28,156 +21,62 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 2, 2, 2, 2, 3, 3 } - inputBoxes = { 1, 1 } inputWidth = { 640, 290 } inputPos = { { 0.275, 0.25, -0.91 }, { 0.6295, 0.25, -0.44 } } --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" - --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +customizations = { + [1] = { + textField = { + position = { 0.275, 0.25, -0.91 }, + width = 640 + } + }, + [2] = { + checkboxes = { + posZ = -0.725, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.44, + count = 2, + } + }, + [4] = { + checkboxes = { + posZ = -0.05, + count = 2, + }, + textField = { + position = { 0.6295, 0.25, -0.44 }, + width = 290 + } + }, + [5] = { + checkboxes = { + posZ = 0.25, + count = 2, + } + }, + [6] = { + checkboxes = { + posZ = 0.545, + count = 2, + }, + }, + [7] = { + checkboxes = { + posZ = 0.75, + count = 3, + } + }, + [8] = { + checkboxes = { + posZ = 0.95, + count = 3, + } + }, +} +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/GrizzledUpgradeSheet.ttslua b/src/playercards/customizable/GrizzledUpgradeSheet.ttslua index 39a5a906..9c96a568 100644 --- a/src/playercards/customizable/GrizzledUpgradeSheet.ttslua +++ b/src/playercards/customizable/GrizzledUpgradeSheet.ttslua @@ -1,19 +1,12 @@ -- Customizable Cards: Grizzled --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons and input boxes boxSize = 40 inputFontsize = 50 -- static values -x_1 = -0.933 -x_offset = 0.075 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.933 +xOffset = 0.075 -- z-values (lines on the sheet) posZ = { @@ -26,156 +19,53 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 2, 3, 4, 5 } - inputBoxes = { 1, 1, 1 } inputWidth = { 600, 875, 875 } inputPos = { { 0.3, 0.25, -0.91 }, { 0.005, 0.25, -0.58 }, { 0.005, 0.25, -0.32 } } - --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" - --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +customizations = { + [1] = { + textField = { + position = { 0.3, 0.25, -0.91 }, + width = 600 + } + }, + [2] = { + checkboxes = { + posZ = -0.71, + count = 1, + }, + textField = { + position = { 0.005, 0.25, -0.58 }, + width = 875 + } + }, + [3] = { + checkboxes = { + posZ = -0.458, + count = 2, + }, + textField = { + position = { 0.005, 0.25, -0.32 }, + width = 875 + } + }, + [4] = { + checkboxes = { + posZ = -0.205, + count = 3, + } + }, + [5] = { + checkboxes = { + posZ = 0.362, + count = 4, + }, + }, + [6] = { + checkboxes = { + posZ = 0.82, + count = 5, + }, + }, +} +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/HonedInstinctUpgradeSheet.ttslua b/src/playercards/customizable/HonedInstinctUpgradeSheet.ttslua index bde1a713..b3856bd2 100644 --- a/src/playercards/customizable/HonedInstinctUpgradeSheet.ttslua +++ b/src/playercards/customizable/HonedInstinctUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Honed Instinct --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 38 -- static values -x_1 = -0.935 -x_offset = 0.069 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.069 -- z-values (lines on the sheet) posZ = { @@ -28,154 +21,57 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 1, 1, 1, 1, 2, 3, 5 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" +customizations = { + [1] = { + checkboxes = { + posZ = -0.905, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.705, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.5, + count = 1, + } + }, + [4] = { + checkboxes = { + posZ = -0.29, + count = 1, + } + }, + [5] = { + checkboxes = { + posZ = -0.09, + count = 1, + }, + }, + [6] = { + checkboxes = { + posZ = 0.12, + count = 2, + } + }, + [7] = { + checkboxes = { + posZ = 0.325, + count = 3, + }, + }, + [8] = { + checkboxes = { + posZ = 0.62, + count = 5, + } + }, +} --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/HuntersArmorUpgradeSheet.ttslua b/src/playercards/customizable/HuntersArmorUpgradeSheet.ttslua index b2ed3fda..2f574b8d 100644 --- a/src/playercards/customizable/HuntersArmorUpgradeSheet.ttslua +++ b/src/playercards/customizable/HuntersArmorUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Hunter's Armor --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 40 -- static values -x_1 = -0.933 -x_offset = 0.075 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.933 +xOffset = 0.075 -- z-values (lines on the sheet) posZ = { @@ -27,154 +20,50 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 2, 2, 2, 2, 3, 3 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" - --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +customizations = { + [1] = { + checkboxes = { + posZ = -0.892, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.560, + count = 2, + } + }, + [3] = { + checkboxes = { + posZ = -0.220, + count = 2, + } + }, + [4] = { + checkboxes = { + posZ = -0.092, + count = 2, + } + }, + [5] = { + checkboxes = { + posZ = 0.047, + count = 2, + }, + }, + [6] = { + checkboxes = { + posZ = 0.376, + count = 3, + } + }, + [7] = { + checkboxes = { + posZ = 0.820, + count = 3, + }, + }, +} +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/HyperphysicalShotcasterUpgradeSheet.ttslua b/src/playercards/customizable/HyperphysicalShotcasterUpgradeSheet.ttslua index fb094979..522ecbeb 100644 --- a/src/playercards/customizable/HyperphysicalShotcasterUpgradeSheet.ttslua +++ b/src/playercards/customizable/HyperphysicalShotcasterUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Hyperphysical Shotcaster --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 38 -- static values -x_1 = -0.935 -x_offset = 0.069 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.069 -- z-values (lines on the sheet) posZ = { @@ -27,154 +20,51 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 2, 2, 2, 2, 2, 4, 4 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" +customizations = { + [1] = { + checkboxes = { + posZ = -0.9, + count = 2, + } + }, + [2] = { + checkboxes = { + posZ = -0.615, + count = 2, + } + }, + [3] = { + checkboxes = { + posZ = -0.237, + count = 2, + } + }, + [4] = { + checkboxes = { + posZ = 0.232, + count = 2, + } + }, + [5] = { + checkboxes = { + posZ = 0.61, + count = 2, + }, + }, + [6] = { + checkboxes = { + posZ = 0.988, + count = 4, + } + }, + [7] = { + checkboxes = { + posZ = 1.185, + count = 4, + }, + }, +} --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/LivingInkUpgradeSheet.ttslua b/src/playercards/customizable/LivingInkUpgradeSheet.ttslua index e8d4db17..9aeafacb 100644 --- a/src/playercards/customizable/LivingInkUpgradeSheet.ttslua +++ b/src/playercards/customizable/LivingInkUpgradeSheet.ttslua @@ -1,265 +1,79 @@ -- Customizable Cards: Living Ink --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Size information for buttons boxSize = 40 -- static values -x_1 = -0.935 -x_offset = 0.075 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.075 -- z-values (lines on the sheet) -posZ = { - -0.69, - -0.355, - 0.0855, - 0.425, - 0.555, - 0.685, - 1.02 +posZ = { + -0.69, + -0.355, + 0.0855, + 0.425, + 0.555, + 0.685, + 1.02 } -- box setup (amount of boxes per line and amount of marked boxes in that line) -existingBoxes = { 1, 1, 2, 2, 3, 3, 3 } - --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" +existingBoxes = { 1, 1, 2, 2, 3, 3, 3 } +inputBoxes = {} -- Locations of the skill selectors -local SKILL_ICON_POSITIONS = { - willpower = { x = 0.085, z = -0.88}, - intellect = { x = -0.183, z = -0.88}, - combat = { x = -0.473, z = -0.88}, - agility = { x = -0.74, z = -0.88}, +SKILL_ICON_POSITIONS = { + willpower = { x = 0.085, z = -0.88 }, + intellect = { x = -0.183, z = -0.88 }, + combat = { x = -0.473, z = -0.88 }, + agility = { x = -0.74, z = -0.88 }, } -local selectedSkills = { - willpower = false, - intellect = false, - combat = false, - agility = false +customizations = { + [1] = { }, -- Empty placeholder for skill selection row, handled by custom skill display + [2] = { + checkboxes = { + posZ = -0.69, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.355, + count = 1, + } + }, + [4] = { + checkboxes = { + posZ = 0.0855, + count = 2, + } + }, + [5] = { + checkboxes = { + posZ = 0.425, + count = 2, + } + }, + [6] = { + checkboxes = { + posZ = 0.555, + count = 3, + }, + }, + [7] = { + checkboxes = { + posZ = 0.685, + count = 3, + } + }, + [8] = { + checkboxes = { + posZ = 1.02, + count = 3, + }, + }, } --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() - local skillArray = { } - for skill, isSelected in pairs(selectedSkills) do - if (isSelected) then - table.insert(skillArray, skill) - end - end - return JSON.encode({ markedBoxes, skillArray }) -end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - log(loaded_data[2]) - for _, skill in ipairs(loaded_data[2]) do - if (skill ~= "") then - log("Skill from load "..skill) - selectedSkills[skill] = true - end - end - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - local selectedSkills = { - willpower = false, - intellect = false, - combat = false, - agility = false - } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() updateScale(1) end) - self.addContextMenuItem("Scale: double", function() updateScale(2) end) - self.addContextMenuItem("Scale: triple", function() updateScale(3) end) - updateSkillDisplay() -end - -function updateScale(scale) - self.setScale({ scale, 1, scale }) - updateSkillDisplay() -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() - updateSkillDisplay() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - -function click_willpower() - selectedSkills.willpower = not selectedSkills.willpower - updateSkillDisplay() -end - -function click_intellect() - selectedSkills.intellect = not selectedSkills.intellect - updateSkillDisplay() -end - -function click_combat() - selectedSkills.combat = not selectedSkills.combat - updateSkillDisplay() -end - -function click_agility() - selectedSkills.agility = not selectedSkills.agility - updateSkillDisplay() -end - -function createButtonsAndBoxes() - self.clearButtons() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - makeSkillSelectionButtons() -end - --- Creates the invisible buttons overlaying the skill icons -function makeSkillSelectionButtons() - local buttonPositions = { x = -1 * SKILL_ICON_POSITIONS.willpower.x, y = 0.2, z = SKILL_ICON_POSITIONS.willpower.z } - local buttonData = { - click_function = "click_willpower", - function_owner = self, - position = buttonPositions, - height = 130, - width = 130, - scale = { 1, 1, 1 }, - color = { 0, 0, 0, 0 }, - } - self.createButton(buttonData) - buttonData.click_function = "click_intellect" - buttonPositions.x = -1 * SKILL_ICON_POSITIONS.intellect.x - buttonData.position = buttonPositions - self.createButton(buttonData) - buttonData.click_function = "click_combat" - buttonPositions.x = -1 * SKILL_ICON_POSITIONS.combat.x - buttonData.position = buttonPositions - self.createButton(buttonData) - buttonData.click_function = "click_agility" - buttonPositions.x = -1 * SKILL_ICON_POSITIONS.agility.x - buttonData.position = buttonPositions - self.createButton(buttonData) -end - --- Refresh the vector circles indicating a skill is selected. Since we can only have one table of --- vectors set, have to refresh all 4 at once -function updateSkillDisplay() - local circles = { } - for skill, isSelected in pairs(selectedSkills) do - if isSelected then - local circle = getCircleVector(SKILL_ICON_POSITIONS[skill]) - if circle ~= nil then - table.insert(circles, circle) - end - end - end - self.setVectorLines(circles) -end - -function getCircleVector(center) - local diameter = Vector(0, 0, 0.1) - local pointOfOrigin = Vector(center.x, 0.3, center.z) - - -- Declare Results vectors - local vec = Vector(0, 0, 0) - local vecList = {} - - local arcStep = 5 - for i = 0, 360, arcStep do - diameter:rotateOver('y', arcStep) - vec = pointOfOrigin + diameter - vec.y = pointOfOrigin.y - table.insert(vecList, vec) - end - - return { - points = vecList, - color = {0.597, 0.195, 0.796}, - thickness = 0.02, - } -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/MakeshiftTrapUpgradeSheet.ttslua b/src/playercards/customizable/MakeshiftTrapUpgradeSheet.ttslua index f43f200c..5a2d5e27 100644 --- a/src/playercards/customizable/MakeshiftTrapUpgradeSheet.ttslua +++ b/src/playercards/customizable/MakeshiftTrapUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Makeshift Trap --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 39 -- static values -x_1 = -0.935 -x_offset = 0.0735 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.0735 -- z-values (lines on the sheet) posZ = { @@ -27,154 +20,51 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 1, 2, 2, 2, 3, 4 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" +customizations = { + [1] = { + checkboxes = { + posZ = -0.889, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.655, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.325, + count = 2, + } + }, + [4] = { + checkboxes = { + posZ = -0.085, + count = 2, + } + }, + [5] = { + checkboxes = { + posZ = 0.252, + count = 2, + }, + }, + [6] = { + checkboxes = { + posZ = 0.585, + count = 3, + } + }, + [7] = { + checkboxes = { + posZ = 0.927, + count = 4, + }, + }, +} --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/PocketMultiToolUpgradeSheet.ttslua b/src/playercards/customizable/PocketMultiToolUpgradeSheet.ttslua index 24c8e8ca..eb3d422e 100644 --- a/src/playercards/customizable/PocketMultiToolUpgradeSheet.ttslua +++ b/src/playercards/customizable/PocketMultiToolUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Pocket Multi Tool --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 40 -- static values -x_1 = -0.933 -x_offset = 0.075 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.933 +xOffset = 0.075 -- z-values (lines on the sheet) posZ = { @@ -27,154 +20,50 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 1, 2, 2, 2, 3, 4 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" - --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +customizations = { + [1] = { + checkboxes = { + posZ = -0.892, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.560, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.326, + count = 2, + } + }, + [4] = { + checkboxes = { + posZ = -0.092, + count = 2, + } + }, + [5] = { + checkboxes = { + posZ = 0.142, + count = 2, + }, + }, + [6] = { + checkboxes = { + posZ = 0.376, + count = 3, + } + }, + [7] = { + checkboxes = { + posZ = 0.610, + count = 4, + }, + }, +} +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/PowerWordUpgradeSheet.ttslua b/src/playercards/customizable/PowerWordUpgradeSheet.ttslua index 9d19459b..b8357fcd 100644 --- a/src/playercards/customizable/PowerWordUpgradeSheet.ttslua +++ b/src/playercards/customizable/PowerWordUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Power Word --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 38 -- static values -x_1 = -0.933 -x_offset = 0.069 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.933 +xOffset = 0.069 -- z-values (lines on the sheet) posZ = { @@ -28,154 +21,57 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 1, 1, 1, 2, 3, 3, 3 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" +customizations = { + [1] = { + checkboxes = { + posZ = -0.905, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.6, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.32, + count = 1, + } + }, + [4] = { + checkboxes = { + posZ = -0.02, + count = 1, + } + }, + [5] = { + checkboxes = { + posZ = 0.28, + count = 2, + }, + }, + [6] = { + checkboxes = { + posZ = 0.48, + count = 3, + } + }, + [7] = { + checkboxes = { + posZ = 0.775, + count = 3, + }, + }, + [8] = { + checkboxes = { + posZ = 0.975, + count = 3, + }, + }, +} --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/RunicAxeUpgradeSheet.ttslua b/src/playercards/customizable/RunicAxeUpgradeSheet.ttslua index 3a365ef0..b9055f91 100644 --- a/src/playercards/customizable/RunicAxeUpgradeSheet.ttslua +++ b/src/playercards/customizable/RunicAxeUpgradeSheet.ttslua @@ -1,18 +1,11 @@ -- Customizable Cards: Runic Axe --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 38 -- static values -x_1 = -0.935 -x_offset = 0.0705 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.0705 -- z-values (lines on the sheet) posZ = { @@ -28,154 +21,57 @@ posZ = { -- box setup (amount of boxes per line and amount of marked boxes in that line) existingBoxes = { 1, 1, 1, 1, 1, 3, 3, 4 } - inputBoxes = {} --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" +customizations = { + [1] = { + checkboxes = { + posZ = -0.92, + count = 1, + } + }, + [2] = { + checkboxes = { + posZ = -0.715, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.415, + count = 1, + } + }, + [4] = { + checkboxes = { + posZ = -0.018, + count = 1, + } + }, + [5] = { + checkboxes = { + posZ = 0.265, + count = 1, + }, + }, + [6] = { + checkboxes = { + posZ = 0.66, + count = 3, + } + }, + [7] = { + checkboxes = { + posZ = 0.86, + count = 3, + }, + }, + [8] = { + checkboxes = { + posZ = 1.065, + count = 4, + }, + }, +} --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/SummonedServitorUpgradeSheet.ttslua b/src/playercards/customizable/SummonedServitorUpgradeSheet.ttslua index 11bcf950..c053d949 100644 --- a/src/playercards/customizable/SummonedServitorUpgradeSheet.ttslua +++ b/src/playercards/customizable/SummonedServitorUpgradeSheet.ttslua @@ -1,276 +1,89 @@ -- Customizable Cards: Summoned Servitor --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons boxSize = 35 -- static values -x_1 = -0.935 -x_offset = 0.068 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.068 -- z-values (lines on the sheet) -posZ = { - -0.92, - -0.625, - -0.33, - 0.055, - 0.26, - 0.56, - 0.765, - 1.06 +posZ = { + -0.92, + -0.625, + -0.33, + 0.055, + 0.26, + 0.56, + 0.765, + 1.06 } -- box setup (amount of boxes per line and amount of marked boxes in that line) -existingBoxes = { 1, 1, 1, 1, 1, 2, 3, 5 } - -inputBoxes = {} +existingBoxes = { 1, 1, 1, 1, 1, 2, 3, 5 } +inputBoxes = {} -- Locations of the slot selectors -local SLOT_ICON_POSITIONS = { - arcane = { x = 0.160, z = 0.65}, - ally = { x = -0.073, z = 0.65} +SLOT_ICON_POSITIONS = { + arcane = { x = 0.160, z = 0.65 }, + ally = { x = -0.073, z = 0.65 } } -- These match with ArkhamDB's way of storing the data in the dropdown menu -local slotIndices = {arcane = "1", ally = "0", none = ""} +SLOT_INDICES = { arcane = "1", ally = "0", none = "" } +--selectedSlot = SLOT_INDICES.none -local selectedSlot = slotIndices.none - --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" - --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, {selectedSlot} }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - selectedSlot = loaded_data[2][1] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - selectedSlot = "" - end - - makeData() - createButtonsAndBoxes() - updateSlotDisplay() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() - updateSlotDisplay() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end - - makeSlotSelectionButtons() -end - --- Creates the invisible buttons overlaying the slot words -function makeSlotSelectionButtons() - local buttonPositions = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z } - local buttonData = { - click_function = "click_arcane", - function_owner = self, - position = buttonPositions, - height = 130, - width = 130, - scale = { 1, 1, 1 }, - color = { 0, 0, 0, 0 }, +customizations = { + [1] = { + checkboxes = { + posZ = -0.92, + count = 1, } - self.createButton(buttonData) - buttonData.click_function = "click_ally" - buttonPositions.x = -1 * SLOT_ICON_POSITIONS.ally.x - buttonData.position = buttonPositions - self.createButton(buttonData) -end - -function click_arcane() - if selectedSlot == slotIndices.arcane then - selectedSlot = slotIndices.none - else - selectedSlot = slotIndices.arcane - end - updateSlotDisplay() -end - -function click_ally() - if selectedSlot == slotIndices.ally then - selectedSlot = slotIndices.none - else - selectedSlot = slotIndices.ally - end - updateSlotDisplay() -end - --- Refresh the vector circles indicating a slot is selected. -function updateSlotDisplay() - local box = {} - local center = {} - center = SLOT_ICON_POSITIONS["arcane"] - local arcaneVecList = { - Vector(center.x + 0.12, 0.3, center.z + 0.05), - Vector(center.x - 0.12, 0.3, center.z + 0.05), - Vector(center.x - 0.12, 0.3, center.z - 0.05), - Vector(center.x + 0.12, 0.3, center.z - 0.05), - Vector(center.x + 0.12, 0.3, center.z + 0.05), + }, + [2] = { + checkboxes = { + posZ = -0.625, + count = 1, } - center = SLOT_ICON_POSITIONS["ally"] - local allyVecList = { - Vector(center.x + 0.07, 0.3, center.z + 0.05), - Vector(center.x - 0.07, 0.3, center.z + 0.05), - Vector(center.x - 0.07, 0.3, center.z - 0.05), - Vector(center.x + 0.07, 0.3, center.z - 0.05), - Vector(center.x + 0.07, 0.3, center.z + 0.05), + }, + [3] = { + checkboxes = { + posZ = -0.33, + count = 1, } - local arcaneVecColor = {0.5, 0.5, 0.5, 0.75} - local allyVecColor = {0.5, 0.5, 0.5, 0.75} - if selectedSlot == slotIndices.arcane then - arcaneVecColor = {0.597, 0.195, 0.796} - elseif selectedSlot == slotIndices.ally then - allyVecColor = {0.597, 0.195, 0.796} - end + }, + [4] = { + checkboxes = { + posZ = 0.055, + count = 1, + } + }, + [5] = { + checkboxes = { + posZ = 0.26, + count = 1, + }, + }, + [6] = { + checkboxes = { + posZ = 0.56, + count = 2, + } + -- Row 6 includes the selection of Arcane/Ally slot, presented with buttons but stored + -- as a text field + }, + [7] = { + checkboxes = { + posZ = 0.765, + count = 3, + }, + }, + [8] = { + checkboxes = { + posZ = 1.06, + count = 5, + }, + }, +} - self.setVectorLines({ - { - points = arcaneVecList, - color = arcaneVecColor, - thickness = 0.02, - }, - { - points = allyVecList, - color = allyVecColor, - thickness = 0.02, - }, - - }) -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/TheRavenQuillUpgradeSheet.ttslua b/src/playercards/customizable/TheRavenQuillUpgradeSheet.ttslua index e213bf7c..7ac61d93 100644 --- a/src/playercards/customizable/TheRavenQuillUpgradeSheet.ttslua +++ b/src/playercards/customizable/TheRavenQuillUpgradeSheet.ttslua @@ -1,183 +1,66 @@ -- Customizable Cards: The Raven Quill --- by Chr1Z -information = { - version = "1.7", - last_updated = "12.10.2022" -} -- Color information for buttons and input boxes -boxSize = 37 +boxSize = 37 inputFontsize = 38 -- static values -x_1 = -0.935 -x_offset = 0.0705 -y_visible = 0.25 -y_invisible = -0.5 +xInitial = -0.935 +xOffset = 0.0705 --- z-values (lines on the sheet) -posZ = { - -0.72, - -0.52, - -0.305, - -0.105, - 0.1, - 0.4, - 0.695 +customizations = { + [1] = { + textField = { + position = { 0.5, 0.25, -0.905 }, + width = 425 + } + }, + [2] = { + checkboxes = { + posZ = -0.72, + count = 1, + } + }, + [3] = { + checkboxes = { + posZ = -0.52, + count = 1, + } + }, + [4] = { + checkboxes = { + posZ = -0.305, + count = 2, + } + }, + [5] = { + checkboxes = { + posZ = -0.105, + count = 2, + }, + textField = { + position = { 0.125, 0.25, 0 }, + width = 775 + } + }, + [6] = { + checkboxes = { + posZ = 0.1, + count = 2, + } + }, + [7] = { + checkboxes = { + posZ = 0.4, + count = 3, + } + }, + [8] = { + checkboxes = { + posZ = 0.695, + count = 4, + } + }, } --- box setup (amount of boxes per line and amount of marked boxes in that line) -existingBoxes = { 1, 1, 2, 2, 2, 3, 4 } - -inputBoxes = { 1, 1 } -inputWidth = { 425, 775 } -inputPos = { { 0.5, 0.25, -0.905 }, { 0.125, 0.25, 0 } } - --- override 'marked boxes' for debugging ('all' or 'none') -markDEBUG = "" - --- save state when going into bags / decks -function onDestroy() self.script_state = onSave() end - -function onSave() return JSON.encode({ markedBoxes, inputValues }) end - --- Startup procedure -function onLoad(saved_data) - if saved_data ~= "" and markDEBUG == "" then - local loaded_data = JSON.decode(saved_data) - markedBoxes = loaded_data[1] - inputValues = loaded_data[2] - else - markedBoxes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - inputValues = { "", "", "", "", "" } - end - - makeData() - createButtonsAndBoxes() - - self.addContextMenuItem("Reset Inputs", function() updateState() end) - self.addContextMenuItem("Scale: normal", function() self.setScale({ 1, 1, 1 }) end) - self.addContextMenuItem("Scale: double", function() self.setScale({ 2, 1, 2 }) end) - self.addContextMenuItem("Scale: triple", function() self.setScale({ 3, 1, 3 }) end) -end - -function updateState(markedBoxesNew) - if markedBoxesNew then markedBoxes = markedBoxesNew end - makeData() - createButtonsAndBoxes() -end - --- create Data -function makeData() - Data = {} - Data.checkbox = {} - Data.textbox = {} - - -- repeat this for each entry (= line) in existingBoxes - local totalCount = 0 - for i = 1, #existingBoxes do - -- repeat this for each checkbox per line - for j = 1, existingBoxes[i] do - totalCount = totalCount + 1 - Data.checkbox[totalCount] = {} - Data.checkbox[totalCount].pos = {} - Data.checkbox[totalCount].pos.x = x_1 + j * x_offset - Data.checkbox[totalCount].pos.z = posZ[i] - Data.checkbox[totalCount].row = i - - if (markDEBUG == "all") or (markedBoxes[i] >= j and markDEBUG ~= "none") then - Data.checkbox[totalCount].pos.y = y_visible - Data.checkbox[totalCount].state = true - else - Data.checkbox[totalCount].pos.y = y_invisible - Data.checkbox[totalCount].state = false - end - end - end - - -- repeat this for each entry (= line) in inputBoxes - local totalCount = 0 - for i = 1, #inputBoxes do - -- repeat this for each textbox per line - for j = 1, inputBoxes[i] do - totalCount = totalCount + 1 - Data.textbox[totalCount] = {} - Data.textbox[totalCount].pos = inputPos[totalCount] - Data.textbox[totalCount].width = inputWidth[totalCount] - Data.textbox[totalCount].value = inputValues[totalCount] - end - end -end - --- checks or unchecks the given box -function click_checkbox(tableIndex) - local row = Data.checkbox[tableIndex].row - - if Data.checkbox[tableIndex].state == true then - Data.checkbox[tableIndex].pos.y = y_invisible - Data.checkbox[tableIndex].state = false - - markedBoxes[row] = markedBoxes[row] - 1 - else - Data.checkbox[tableIndex].pos.y = y_visible - Data.checkbox[tableIndex].state = true - - markedBoxes[row] = markedBoxes[row] + 1 - end - - self.editButton({ - index = tableIndex - 1, - position = Data.checkbox[tableIndex].pos - }) -end - --- updates saved value for given text box -function click_textbox(i, value, selected) - if selected == false then - inputValues[i] = value - end -end - -function createButtonsAndBoxes() - self.clearButtons() - self.clearInputs() - - for i, box_data in ipairs(Data.checkbox) do - local funcName = "checkbox" .. i - local func = function() click_checkbox(i) end - self.setVar(funcName, func) - - self.createButton({ - click_function = funcName, - function_owner = self, - position = box_data.pos, - height = boxSize, - width = boxSize, - font_size = box_data.size, - scale = { 1, 1, 1 }, - color = { 0, 0, 0 }, - font_color = { 0, 0, 0 } - }) - end - - for i, box_data in ipairs(Data.textbox) do - local funcName = "textbox" .. i - local func = function(_, _, val, sel) click_textbox(i, val, sel) end - self.setVar(funcName, func) - - self.createInput({ - input_function = funcName, - function_owner = self, - label = "Click to type", - alignment = 2, - position = box_data.pos, - scale = buttonScale, - width = box_data.width, - height = (inputFontsize * 1) + 24, - font_size = inputFontsize, - color = "White", - font_color = buttonFontColor, - value = box_data.value - }) - end -end +require("playercards/customizable/UpgradeSheetLibrary") diff --git a/src/playercards/customizable/UpgradeSheetLibrary.ttslua b/src/playercards/customizable/UpgradeSheetLibrary.ttslua new file mode 100644 index 00000000..2356fd91 --- /dev/null +++ b/src/playercards/customizable/UpgradeSheetLibrary.ttslua @@ -0,0 +1,433 @@ +-- Common code for handling customizable card upgrade sheets +-- Define UI elements in the base card file, then include this +-- UI element definition is an array of tables, each with this structure. A row may include +-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom +-- handling, as Living Ink does) +-- { +-- checkboxes = { +-- posZ = -0.71, +-- count = 1, +-- }, +-- textField = { +-- position = { 0.005, 0.25, -0.58 }, +-- width = 875 +-- } +-- } +-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to +-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize. +-- +-- selectedUpgrades holds the state of checkboxes and text input, each element being: +-- selectedUpgrades[row] = { xp = #, text = "" } + +-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object +-- when not selected. +local Y_VISIBLE = 0.25 +local Y_INVISIBLE = -0.5 + +-- Used for Summoned Servitor and Living Ink +local VECTOR_COLOR = { + unselected = { 0.5, 0.5, 0.5, 0.75 }, + mystic = { 0.597, 0.195, 0.796 } +} + +-- These match with ArkhamDB's way of storing the data in the dropdown menu +local SUMMONED_SERVITOR_SLOT_INDICES = { arcane = "1", ally = "0", none = "" } + +local rowCheckboxFirstIndex = { } +local rowInputIndex = { } +local selectedUpgrades = { } + +-- save state when going into bags / decks +function onDestroy() self.script_state = onSave() end + +function onSave() + return JSON.encode({ + selections = selectedUpgrades + }) +end + +-- Startup procedure +function onLoad(savedData) + if savedData ~= "" then + local loadedData = JSON.decode(savedData) + if loadedData.selections ~= nil then + selectedUpgrades = loadedData.selections + end + end + + selfId = getSelfId() + + maybeLoadLivingInkSkills() + createUi() + maybeUpdateLivingInkSkillDisplay() + maybeUpdateServitorSlotDisplay() + + self.addContextMenuItem("Clear Selections", function() resetSelections() end) + self.addContextMenuItem("Scale: 1x", function() self.setScale({ 1, 1, 1 }) end) + self.addContextMenuItem("Scale: 2x", function() self.setScale({ 2, 1, 2 }) end) + self.addContextMenuItem("Scale: 3x", function() self.setScale({ 3, 1, 3 }) end) +end + +-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor) +function getSelfId() + local metadata = JSON.decode(self.getGMNotes()) + return metadata.id +end + +function resetSelections() + selectedUpgrades = { } + updateDisplay() +end + +function createUi() + if customizations == nil then + return + end + for i = 1, #customizations do + if customizations[i].checkboxes ~= nil then + createRowCheckboxes(i) + end + if customizations[i].textField ~= nil then + createRowTextField(i) + end + end + maybeMakeLivingInkSkillSelectionButtons() + maybeMakeServitorSlotSelectionButtons() + updateDisplay() +end + +function createRowCheckboxes(rowIndex) + local checkboxes = customizations[rowIndex].checkboxes + rowCheckboxFirstIndex[rowIndex] = 0 + local previousButtons = self.getButtons() + if previousButtons ~= nil then + rowCheckboxFirstIndex[rowIndex] = #previousButtons + end + for col = 1, checkboxes.count do + local funcName = "checkboxRow" .. rowIndex .. "Col" .. col + local func = function() clickCheckbox(rowIndex, col) end + self.setVar(funcName, func) + local checkboxPos = getCheckboxPosition(rowIndex, col) + + self.createButton({ + click_function = funcName, + function_owner = self, + position = checkboxPos, + height = boxSize * 10, + width = boxSize * 10, + font_size = 1000, + scale = { 0.1, 0.1, 0.1 }, + color = { 0, 0, 0 }, + font_color = { 0, 0, 0 } + }) + end +end + +function getCheckboxPosition(row, col) + return { + x = xInitial + col * xOffset, + y = Y_VISIBLE, + z = customizations[row].checkboxes.posZ + } +end + +function createRowTextField(rowIndex) + local textField = customizations[rowIndex].textField + + rowInputIndex[rowIndex] = 0 + local previousInputs = self.getInputs() + if previousInputs ~= nil then + rowInputIndex[rowIndex] = #previousInputs + end + local funcName = "textbox" .. rowIndex + local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end + self.setVar(funcName, func) + + self.createInput({ + input_function = funcName, + function_owner = self, + label = "Click to type", + alignment = 2, + position = textField.position, + scale = { 0.1, 0.1, 0.1 }, + width = textField.width * 10, + height = inputFontsize * 10 + 75, + font_size = inputFontsize * 10.5, + color = "White", + value = "" + }) +end + +function updateDisplay() + for i = 1, #customizations do + updateRowDisplay(i) + end + maybeUpdateLivingInkSkillDisplay() + maybeUpdateServitorSlotDisplay() +end + +function updateRowDisplay(rowIndex) + if customizations[rowIndex].checkboxes ~= nil then + updateCheckboxes(rowIndex) + end + if customizations[rowIndex].textField ~= nil then + updateTextField(rowIndex) + end +end + +function updateCheckboxes(rowIndex) + local checkboxCount = customizations[rowIndex].checkboxes.count + local selected = 0 + if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then + selected = selectedUpgrades[rowIndex].xp + end + local checkboxIndex = rowCheckboxFirstIndex[rowIndex] + for col = 1, checkboxCount do + local pos = getCheckboxPosition(rowIndex, col) + if col <= selected then + pos.y = Y_VISIBLE + else + pos.y = Y_INVISIBLE + end + self.editButton({ + index = checkboxIndex, + position = pos + }) + checkboxIndex = checkboxIndex + 1 + end +end + +function updateTextField(rowIndex) + local inputIndex = rowInputIndex[rowIndex] + if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then + self.editInput({ + index = inputIndex, + value = " " .. selectedUpgrades[rowIndex].text + }) + end +end + +function clickCheckbox(row, col, buttonIndex) + if selectedUpgrades[row] == nil then + selectedUpgrades[row] = { } + selectedUpgrades[row].xp = 0 + end + if selectedUpgrades[row].xp == col then + selectedUpgrades[row].xp = col - 1 + else + selectedUpgrades[row].xp = col + end + updateCheckboxes(row) +end + +-- Updates saved value for given text box when it loses focus +function clickTextbox(rowIndex, value, selected) + if selected == false then + if selectedUpgrades[rowIndex] == nil then + selectedUpgrades[rowIndex] = { } + end + selectedUpgrades[rowIndex].text = value:gsub("^%s*(.-)%s*$", "%1") + -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished + Wait.frames(function() updateRowDisplay(rowIndex) end, 1) + end +end + +--------------------------------------------------------- +-- Living Ink related functions +--------------------------------------------------------- + +-- Builds the list of boolean skill selections from the Row 1 text field +function maybeLoadLivingInkSkills() + if selfId ~= "09079-c" then return end + selectedSkills = { + willpower = false, + intellect = false, + combat = false, + agility = false + } + if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then + for skill in string.gmatch(selectedUpgrades[1].text, "([^,]+)") do + selectedSkills[skill] = true + end + end +end + +function clickSkill(skillname) + selectedSkills[skillname] = not selectedSkills[skillname] + maybeUpdateLivingInkSkillDisplay() + updateSelectedLivingInkSkillText() +end + +-- Creates the invisible buttons overlaying the skill icons +function maybeMakeLivingInkSkillSelectionButtons() + if selfId ~= "09079-c" then return end + + local buttonData = { + function_owner = self, + position = { y = 0.2 }, + height = 130, + width = 130, + color = { 0, 0, 0, 0 }, + } + + for skillname, _ in pairs(selectedSkills) do + local funcName = "clickSkill" .. skillname + self.setVar(funcName, function() clickSkill(skillname) end) + + buttonData.click_function = funcName + buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x + buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z + self.createButton(buttonData) + end +end + +-- Builds a comma-delimited string of skills and places it in the Row 1 text field +function updateSelectedLivingInkSkillText() + local skillString = "" + if selectedSkills.willpower then + skillString = skillString .. "willpower" .. "," + end + if selectedSkills.intellect then + skillString = skillString .. "intellect" .. "," + end + if selectedSkills.combat then + skillString = skillString .. "combat" .. "," + end + if selectedSkills.agility then + skillString = skillString .. "agility" .. "," + end + if selectedUpgrades[1] == nil then + selectedUpgrades[1] = { } + end + selectedUpgrades[1].text = skillString +end + +-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of +-- vectors set, have to refresh all 4 at once +function maybeUpdateLivingInkSkillDisplay() + if selfId ~= "09079-c" then return end + local circles = {} + for skill, isSelected in pairs(selectedSkills) do + if isSelected then + local circle = getCircleVector(SKILL_ICON_POSITIONS[skill]) + if circle ~= nil then + table.insert(circles, circle) + end + end + end + self.setVectorLines(circles) +end + +function getCircleVector(center) + local diameter = Vector(0, 0, 0.1) + local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z) + local vec + local vecList = {} + local arcStep = 5 + for i = 0, 360, arcStep do + diameter:rotateOver('y', arcStep) + vec = pointOfOrigin + diameter + vec.y = pointOfOrigin.y + table.insert(vecList, vec) + end + + return { + points = vecList, + color = VECTOR_COLOR.mystic, + thickness = 0.02, + } +end + +--------------------------------------------------------- +-- Summoned Servitor related functions +--------------------------------------------------------- + +-- Creates the invisible buttons overlaying the slot words +function maybeMakeServitorSlotSelectionButtons() + if selfId ~= "09080-c" then return end + + local buttonData = { + click_function = "clickArcane", + function_owner = self, + position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z }, + height = 130, + width = 130, + color = { 0, 0, 0, 0 }, + } + self.createButton(buttonData) + + buttonData.click_function = "clickAlly" + buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x + self.createButton(buttonData) +end + +-- toggles the clicked slot +function clickArcane() + if selectedUpgrades[6] == nil then + selectedUpgrades[6] = { } + end + if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then + selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none + else + selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane + end + maybeUpdateServitorSlotDisplay() +end + +-- toggles the clicked slot +function clickAlly() + if selectedUpgrades[6] == nil then + selectedUpgrades[6] = { } + end + if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then + selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none + else + selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally + end + maybeUpdateServitorSlotDisplay() +end + +-- Refresh the vector circles indicating a slot is selected. +function maybeUpdateServitorSlotDisplay() + if selfId ~= "09080-c" then return end + + local center = SLOT_ICON_POSITIONS["arcane"] + local arcaneVecList = { + Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05), + Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05), + Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05), + Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05), + Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05), + } + + center = SLOT_ICON_POSITIONS["ally"] + local allyVecList = { + Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05), + Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05), + Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05), + Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05), + Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05), + } + + local arcaneVecColor = VECTOR_COLOR.unselected + local allyVecColor = VECTOR_COLOR.unselected + + if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then + arcaneVecColor = VECTOR_COLOR.mystic + elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then + allyVecColor = VECTOR_COLOR.mystic + end + + self.setVectorLines({ + { + points = arcaneVecList, + color = arcaneVecColor, + thickness = 0.02, + }, + { + points = allyVecList, + color = allyVecColor, + thickness = 0.02, + } + }) +end