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> </button>
</div> </div>
<div class = "col-lg-3 col-sm-6"> <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 Copy Hash
</button> </button>
</div> </div>

View file

@ -264,7 +264,7 @@ function populateFields() {
*/ */
function copyRecipeHash() { function copyRecipeHash() {
if (player_craft) { if (player_craft) {
copyTextToClipboard("CR-"+location.hash); copyTextToClipboard("CR-"+location.hash.slice(1));
document.getElementById("copy-hash-button").textContent = "Copied!"; 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. * Populate fields based on url, and calculate build.
*/ */
function decodeBuild(url_tag) { function decodeBuild(url_tag) {
console.log("decoding build");
if (url_tag) { if (url_tag) {
//default values //default values
let equipment = [null, null, null, null, null, null, null, null, null]; 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 info_str = info[1];
let start_idx = 0; let start_idx = 0;
for (let i = 0; i < 9; ++i ) { for (let i = 0; i < 9; ++i ) {
if (info_str.charAt(start_idx) === "-") { console.log(info_str.slice(start_idx,start_idx+3));
equipment[i] = "CR-"+info_str.slice(start_idx+1, start_idx+18); if (info_str.slice(start_idx,start_idx+3) === "CR-") {
start_idx += 18; console.log(info_str.slice(start_idx, start_idx+20));
} equipment[i] = info_str.slice(start_idx, start_idx+20);
else { start_idx += 20;
} else {
let equipment_str = info_str.slice(start_idx, start_idx+3); let equipment_str = info_str.slice(start_idx, start_idx+3);
equipment[i] = getItemNameFromID(Base64.toInt(equipment_str)); equipment[i] = getItemNameFromID(Base64.toInt(equipment_str));
start_idx += 3; start_idx += 3;