Skip to content

Instantly share code, notes, and snippets.

@nathankellenicki
Last active March 6, 2022 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathankellenicki/4f44af4f72c4d9e1df5692489462bb74 to your computer and use it in GitHub Desktop.
Save nathankellenicki/4f44af4f72c4d9e1df5692489462bb74 to your computer and use it in GitHub Desktop.
Bank of the Core GCC-1000 Currency Converter
<!DOCTYPE html>
<html>
<head>
<title>Bank of the Core GCC-1000 Currency Converter</title>
<style>
.strike {
text-decoration: line-through;
}
</style>
<script>
// Made by Nathan Kellenicki (@nkellenicki/@nathankellenicki), because why not.
// This allows conversion between various fictional Star Wars currencies.
const base = "USD";
const rates = {
"GCS": 0.016666666666667,
"BSP": 0.0095247,
"HWU": 0.02286040862,
"USD": 1
};
const convert = () => {
const amount = document.getElementById("amount").value;
const from = document.getElementById("from").value;
const to = document.getElementById("to").value;
if (from === base) {
const converted = rates[to] * amount;
render(converted);
} else if (to === base) {
const converted = (1 / rates[from]) * amount;
render(converted);
} else {
const converted = (rates[to] * (1 / rates[from])) * amount;
render(converted);
}
}
const render = (amount) => {
const resultElement = document.getElementById("result");
resultElement.innerText = amount.toFixed(2);
}
window.addEventListener("load", () => {
convert();
document.getElementById("amount").addEventListener("input", () => convert());
document.getElementById("amount").addEventListener("change", () => convert());
document.getElementById("from").addEventListener("change", () => convert());
document.getElementById("to").addEventListener("change", () => convert());
});
</script>
</head>
<body>
<h1>Bank of the Core GCC-1000 Currency Converter</h1>
<div><input type="text" id="amount" value="1" /> <select id="from">
<option value="USD">United States Dollar</option>
<option value="GCS">Galactic Credit Standard</option>
<option value="BSP">Batuuan Spira</option>
<option value="HWU">Huttese Wupiupi</option>
</select> equals <span id="result">1</span> <select id="to">
<option value="USD">United States Dollar</option>
<option value="GCS" selected>Galactic Credit Standard</option>
<option value="BSP">Batuuan Spira</option>
<option value="HWU">Huttese Wupiupi</option>
</select></div>
<h1>Sources</h1>
<ul>
<li>The Galactic Credit Standard is the official name for the currency that was the Republic Credit, which later became the Imperial Credit. After Star Wars: The Force Awakens, it became known as the New Republic Credit.</li>
<li>The book "Star Wars: Absolutely Everything You Need to Know" states that 1 Huttese Wupiupi is valued at around 0.625 Republic Credits.</li>
<li class="strike">At Black Spire Outpost (Star Wars: Galaxys Edge), 1 Batuuan Spira can be purchased for $100 USD (We ignore the fact that it is a gift card than can be loaded with more than $100, and that you get to keep the bit of metal after spending).</li>
<li>As of Sept 2020, the Batuuan Spira now requires a $4.99 USD non-refundable "activation charge" on top of the $100 USD minimum load. As a result, the Batuuan Spira is now considered to cost $104.99 USD.</li>
<li class="strike">At Black Spire Outpost (Star Wars: Galaxys Edge), 1 Imperial Credit can be purchased for $69.99 USD.</li>
<li>As of late 2021, 1 Imperial Credit now costs $60 USD at Black Spire Outpost.</li>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment