Skip to content

Instantly share code, notes, and snippets.

@Meshiest
Last active November 21, 2021 00:49
Show Gist options
  • Save Meshiest/b00cf7a57804e0c854377ac1b110ba4c to your computer and use it in GitHub Desktop.
Save Meshiest/b00cf7a57804e0c854377ac1b110ba4c to your computer and use it in GitHub Desktop.
brickadia a4 to a5 save converter
<!DOCTYPE html>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dist.js"></script>
<h3>a4 -> a5 studded cube migrator</h3>
<div class="deliberate-inline-css-to-piss-you-off" style="height: 100px;">
<img class="preview" src="https://i.imgur.com/eKqpITD.png" width="100">
</div>
<p>A5 no longer supports the non-procedural <code>B_2x_Cube_Side</code> and it is now called <code>PB_DefaultStudded</code>.</p>
<p>This tool migrates it. Simply select a save below and click download when the link is available.</p>
<p>
<!-- Files uploaded will be -->
<input id="fileInput" type="file">
<a id="anchor" download="migrated.brs">Download</a>
</p>
<!-- This will be filled with the save object as JSON or the error message -->
<pre id="jsonElem"></pre>
<img src="https://67.media.tumblr.com/636e32142bbf8ab7609af99f771092b5/tumblr_nzmb1mz6gC1tkxhabo1_400.gif" width="40">
<img src="https://67.media.tumblr.com/636e32142bbf8ab7609af99f771092b5/tumblr_nzmb1mz6gC1tkxhabo1_400.gif" width="40">
<img src="https://67.media.tumblr.com/636e32142bbf8ab7609af99f771092b5/tumblr_nzmb1mz6gC1tkxhabo1_400.gif" width="40">
<img src="https://67.media.tumblr.com/636e32142bbf8ab7609af99f771092b5/tumblr_nzmb1mz6gC1tkxhabo1_400.gif" width="40">
<marquee>WELCOME TO BRICKADIA A5</marquee>
<marquee direction="up">A5 TOMORROW</marquee>
WEAR A MASK<br/>
<div class="pleaseOctillery">
<img src="https://cdn.discordapp.com/emojis/484060805780733952.png?v=1">
<img src="https://cdn.discordapp.com/emojis/689590367473238180.png?v=1">
<img src="https://cdn.discordapp.com/emojis/787378597086232608.png?v=1">
</div>
<style>
body {
color: white;
background: url(https://cdn.discordapp.com/attachments/600493701575475200/788813410841788416/bluestar.jpg) repeat;
background-color: red;
height: 100%;
}
.preview {
top: 50px;
left: 20px;
transition: all 5s linear;
z-index: 20;
position: absolute;
}
.preview:hover {
animation: wowYouReallyPutAGameInASaveConverter 30s linear 1;
}
@keyframes wowYouReallyPutAGameInASaveConverter {
0% {
top: 50px;
left: 20px;
transform: scale(1);
}
10% {
top: 300px;
left: 50px;
}
20% {
top: 300px;
left: 400px;
}
30% {
top: 20px;
left: 800px;
}
40% {
top: 800px;
left: 800px;
}
50% {
top: 800px;
left: 0px;
}
60% {
top: 600px;
left: 200px;
}
70% {
top: 400px;
left: 200px;
}
80% {
top: 400px;
left: 200px;
transform: scale(1);
}
90% {
top: 100px;
left: 200px;
transform: scale(0.5);
}
100% {
transform: scale(1);
top: 50px;
left: 20px;
}
}
.pleaseOctillery {
cursor: not-allowed;
display: inline-block;
position: relative;
width: 100px;
height: 100px;
}
.pleaseOctillery::before {
content: 'Please wear a mask';
position: fixed;
pointer-events: none;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: red;
z-index: -100;
display: flex;
align-items: center;
justify-content: center;
font-size: 10vh;
font-family: impact, sans-serif;
opacity: 0;
}
.pleaseOctillery:hover::before {
z-index: 100;
opacity: 1;
animation: wearAMask 16s linear 1;
}
.pleaseOctillery img {
position: absolute;
top: 0;
left: 0;
}
.pleaseOctillery :nth-child(1) {
display: none;
}
.pleaseOctillery :nth-child(2) {
display: inline-block;
}
.pleaseOctillery :nth-child(3) {
display: none;
transform: scale(10);
filter: hue-rotate(100deg);
}
.pleaseOctillery:hover :nth-child(1) {
display: inline-block;
}
.pleaseOctillery:hover :nth-child(3) {
display: inline-block;
animation: awareIsMad 15s linear 1;
}
.pleaseOctillery:hover :nth-child(2) {
display: none;
}
@keyframes wearAMask {
0% {opacity: 0;}
93% {opacity: 0;}
100% {opacity: 1;}
}
@keyframes awareIsMad {
0% {
transform: scale(1);
opacity: 0;
filter: hue-rotate(0deg);
}
5% {
opacity: 0;
filter: hue-rotate(0deg);
}
10% {
filter: hue-rotate(100deg);
}
50% {
opacity: 1;
transform: scale(1);
}
98% {
opacity: 1;
transform: scale(3);
filter: hue-rotate(100deg);
}
100% {
transform: scale(10);
}
}
</style>
<script>
fileInput.addEventListener('change', e => {
const file = e.target.files[0];
if (file) {
// Read the file into a byte array
file.arrayBuffer()
.then(buff => {
const save = BRS.read(buff);
save.brick_assets.push('PB_DefaultStudded');
const studIndex = save.brick_assets.length - 1;
let count = 0;
for (const brick of save.bricks) {
const asset = save.brick_assets[brick.asset_name_index];
if (asset === 'B_2x_Cube_Side') {
brick.asset_name_index = studIndex;
brick.size = [10, 10, 10];
count ++;
}
}
// Render the save object as formatted JSON
jsonElem.innerText = 'migrated ' + count;
const blob = new Blob([BRS.write(save)]);
anchor.download = file.name.replace(/\.brs$/, '_migrated.brs');
anchor.href = URL.createObjectURL(blob);
})
.catch(err => {
// Display the error
jsonElem.innerText = 'Error: ' + err.message;
});
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment