Skip to content

Instantly share code, notes, and snippets.

@0x6273
Created May 19, 2020 14:49
Show Gist options
  • Save 0x6273/69e8d796166b4ff99875ad5612c004b0 to your computer and use it in GitHub Desktop.
Save 0x6273/69e8d796166b4ff99875ad5612c004b0 to your computer and use it in GitHub Desktop.
TP Booster Pack
function boosterJson(cards) {
let firstCard = cards.pop();
let cardStack = {
"objectType": "Card",
"transform": {
"rotation":
{
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"translation":
{
"x": 0,
"y": 0,
"z": 0
},
"scale3D":
{
"x": 1,
"y": 1,
"z": 1
}
},
"simulatingPhysics": false,
"atlasIndex": firstCard.index,
"inHand": false,
"stackSerialization": [],
"primaryColor":
{
"b": 255,
"g": 255,
"r": 255,
"a": 255
},
"secondaryColor":
{
"b": 0,
"g": 0,
"r": 0,
"a": 255
},
"metallic": 0,
"roughness": 1,
"friction": 0.69999998807907104,
"restitution": 0,
"density": 0.5,
"surfaceType": "SurfaceType4",
"objectName": "",
"objectDescription": "",
"collisionType": "CB_Regular",
"templateId": firstCard.templateId,
"shouldSnap": true,
"previousPosition":
{
"x": 0,
"y": 0,
"z": 0
},
"objectScriptPackage": "00000000000000000000000000000000",
"objectScriptName": "",
"objectGroupId": -1,
"bCanBeDamaged": false
};
for (const card of cards) {
cardStack.stackSerialization.push(card);
}
let boosterPack = {
"objectType": "Bag",
"transform": {
"rotation": {
"x": -1.1529386512165729e-07,
"y": -5.8952505099796326e-08,
"z": -0.0056645134463906288,
"w": 0.99998396635055542
},
"translation": {
"x": -15.52601432800293,
"y": -7.5605039596557617,
"z": 89.081809997558594
},
"scale3D": {
"x": 1,
"y": 1,
"z": 1
}
},
"simulatingPhysics": true,
"bagType": "Stack",
"itemsJson": [JSON.stringify(cardStack)],
"primaryColor": {
"b": 255,
"g": 255,
"r": 255,
"a": 255
},
"secondaryColor": {
"b": 0,
"g": 0,
"r": 0,
"a": 255
},
"metallic": 1,
"roughness": 1,
"friction": 0.69999998807907104,
"restitution": 0.30000001192092896,
"density": 1,
"surfaceType": "SurfaceType2",
"objectName": "",
"objectDescription": "",
"collisionType": "CB_Regular",
"templateId": "C134C94B496A8D48C79534A5BDBC8A3D",
"shouldSnap": true,
"previousPosition": {
"x": 0,
"y": 0,
"z": 0
},
"objectScriptPackage": "00000000000000000000000000000000",
"objectScriptName": "",
"objectGroupId": -1,
"bCanBeDamaged": false
};
return JSON.stringify(boosterPack);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment