crafted item version 4 build decode bug fix, crafted page slight bug fixes

This commit is contained in:
ferricles 2022-06-15 12:53:51 -07:00
parent 9f399846a3
commit 0166b7814d
3 changed files with 9 additions and 7 deletions

View file

@ -211,7 +211,7 @@
</button>
</div>
<div class = "col-lg-3 col-sm-6">
<button class = "button rounded scaled-font fw-bold text-light dark-5" id = "craft-button" onclick = "copyRecipeHash()">
<button class = "button rounded scaled-font fw-bold text-light dark-5" id = "copy-hash-button" onclick = "copyRecipeHash()">
Copy Hash
</button>
</div>

View file

@ -264,7 +264,7 @@ function populateFields() {
*/
function copyRecipeHash() {
if (player_craft) {
copyTextToClipboard("CR-"+location.hash);
copyTextToClipboard("CR-"+location.hash.slice(1));
document.getElementById("copy-hash-button").textContent = "Copied!";
}
}

View file

@ -142,6 +142,7 @@ function parsePowdering(powder_info) {
* Populate fields based on url, and calculate build.
*/
function decodeBuild(url_tag) {
console.log("decoding build");
if (url_tag) {
//default values
let equipment = [null, null, null, null, null, null, null, null, null];
@ -168,11 +169,12 @@ function decodeBuild(url_tag) {
let info_str = info[1];
let start_idx = 0;
for (let i = 0; i < 9; ++i ) {
if (info_str.charAt(start_idx) === "-") {
equipment[i] = "CR-"+info_str.slice(start_idx+1, start_idx+18);
start_idx += 18;
}
else {
console.log(info_str.slice(start_idx,start_idx+3));
if (info_str.slice(start_idx,start_idx+3) === "CR-") {
console.log(info_str.slice(start_idx, start_idx+20));
equipment[i] = info_str.slice(start_idx, start_idx+20);
start_idx += 20;
} else {
let equipment_str = info_str.slice(start_idx, start_idx+3);
equipment[i] = getItemNameFromID(Base64.toInt(equipment_str));
start_idx += 3;